Donating all wealth and donating part without zakat intention do not have identical effects. In the former, the entire asset base underlying the due levy is gone; in the latter, the remaining property and liability require ordinary legal assessment.
One cannot generally say that charity automatically discharges zakat. Valid performance and extinguishment when the subject matter disappears are different legal categories.