rust/tests/ui/mem_replace_macro.rs

13 lines
337 B
Rust
Raw Normal View History

2023-04-20 10:19:36 -05:00
//@aux-build:proc_macros.rs:proc-macro
#![warn(clippy::mem_replace_with_default)]
extern crate proc_macros;
use proc_macros::{external, inline_macros};
#[inline_macros]
fn main() {
let s = &mut String::from("foo");
inline!(std::mem::replace($s, Default::default()));
external!(std::mem::replace($s, Default::default()));
}