blob: 0c09344b80d10b7f85d0e5495bc26abcc853a559 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
// aux-build:macro_rules.rs
#![warn(clippy::mem_replace_with_default)]
#[macro_use]
extern crate macro_rules;
macro_rules! take {
($s:expr) => {
std::mem::replace($s, Default::default())
};
}
fn replace_with_default() {
let s = &mut String::from("foo");
take!(s);
take_external!(s);
}
fn main() {
replace_with_default();
}
|