2 #![allow(unused_imports)]
6 clippy::mem_replace_option_with_none,
7 clippy::mem_replace_with_default
12 fn replace_option_with_none() {
13 let mut an_option = Some(1);
14 let _ = mem::replace(&mut an_option, None);
15 let an_option = &mut Some(1);
16 let _ = mem::replace(an_option, None);
19 fn replace_with_default() {
20 let mut s = String::from("foo");
21 let _ = std::mem::replace(&mut s, String::default());
22 let s = &mut String::from("foo");
23 let _ = std::mem::replace(s, String::default());
24 let _ = std::mem::replace(s, Default::default());
28 replace_option_with_none();
29 replace_with_default();