about summary refs log tree commit diff
path: root/tests/ui/mem_replace.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/mem_replace.rs')
-rw-r--r--tests/ui/mem_replace.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/ui/mem_replace.rs b/tests/ui/mem_replace.rs
index 0c4e0f6032d..28915bf6dae 100644
--- a/tests/ui/mem_replace.rs
+++ b/tests/ui/mem_replace.rs
@@ -71,6 +71,14 @@ fn dont_lint_primitive() {
     let _ = std::mem::replace(&mut pint, 0);
 }
 
+// lint is disabled for expressions that are not used because changing to `take` is not the
+// recommended fix. Additionally, the `replace` is #[must_use], so that lint will provide
+// the correct suggestion
+fn dont_lint_not_used() {
+    let mut s = String::from("foo");
+    std::mem::replace(&mut s, String::default());
+}
+
 fn main() {
     replace_option_with_none();
     replace_with_default();