Rust is oxidation of the iron surface. It takes oxygen too, of which there is none available in the jar of water.
Iron nails do not rust in distilled water because rusting requires both oxygen and water, and distilled water lacks sufficient dissolved oxygen. Without oxygen, the chemical reaction that leads to rusting cannot take place. Hence, the iron remains intact when submerged in distilled water.
;