Closed jeffcutsinger closed 3 years ago
In https://github.com/rust-unofficial/patterns/blob/964dd9932b7bf41b0905c264ea065781efcdb6b7/idioms/mem-replace.md,
mem::replace(name, String::new())
can be made more terse by using
mem::take(name)
instead. Rust playground link to show it still compiles: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=6f29fd3165760bf068a7c4200fa8cbc5
Interested to send a patch for this?
In https://github.com/rust-unofficial/patterns/blob/964dd9932b7bf41b0905c264ea065781efcdb6b7/idioms/mem-replace.md,
mem::replace(name, String::new())
can be made more terse by using
mem::take(name)
instead. Rust playground link to show it still compiles: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=6f29fd3165760bf068a7c4200fa8cbc5