English equivalent for "Don't burn your house to smoke out a rat!" [duplicate]

This idiom carries the same idea, but it is expressed as a description of what happens when the magnitude of the 'solution' far exceeds the needs of the problem:

Using a sledgehammer to crack a nut.

This idiom has the reverse idea:

Don't throw the baby out with the bathwater.

Instead of advocating restraint when a portion is bad and the rest is valuable, it advocates care when a portion is valuable and the rest is unwanted.


"Don't cut off your nose to spite your face."

It is not an exact match, but it is an interesting expression. Cutting off the nose to spite the face is used to:

describe a needlessly self-destructive over-reaction to a problem: "Don't cut off your nose to spite your face" is a warning against acting out of pique, or against pursuing revenge in a way that would damage oneself more than the object of one's anger.

...It was not uncommon in the Middle Ages for a person to cut the nose off of another for various reasons, including punishment from the state, or as an act of revenge. Cognitive scientist Steven Pinker notes that the phrase may have originated from this practice, as at this time "cutting off someone's nose was the prototypical act of spite."

The expression has since become a blanket term for (often unwise) self-destructive actions motivated purely by anger or desire for revenge. For example, if a man was angered by his wife, he might burn down their house to punish her; however, burning down her house would also mean burning down his, along with all of their possessions.

[Wikipedia]