For example, by explicitly calling shrink_to_fit. So you either have fragmentation, or an extra copy if you're not careful, but none of the solutions let you forget about the detail entirely.
Edit: I submitted a PR to clear up the docs: https://github.com/rust-lang/rust/pull/120110