]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/mem_replace.stderr
Prevent `mem_replace_with_default` lint within macros
[rust.git] / tests / ui / mem_replace.stderr
index 1ce9fc38093e92ba4f18cad74ff4b11a59235875..9c925cefb04cb9d4b45b099369d3acb89bb377a7 100644 (file)
@@ -1,10 +1,36 @@
 error: replacing an `Option` with `None`
- --> $DIR/mem_replace.rs:8:13
-  |
-8 |     let _ = mem::replace(&mut an_option, None);
-  |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider `Option::take()` instead: `an_option.take()`
-  |
-  = note: `-D clippy::mem-replace-option-with-none` implied by `-D warnings`
-
-error: aborting due to previous error
+  --> $DIR/mem_replace.rs:33:13
+   |
+LL |     let _ = mem::replace(&mut an_option, None);
+   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider `Option::take()` instead: `an_option.take()`
+   |
+   = note: `-D clippy::mem-replace-option-with-none` implied by `-D warnings`
+
+error: replacing an `Option` with `None`
+  --> $DIR/mem_replace.rs:35:13
+   |
+LL |     let _ = mem::replace(an_option, None);
+   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider `Option::take()` instead: `an_option.take()`
+
+error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take`
+  --> $DIR/mem_replace.rs:40:13
+   |
+LL |     let _ = std::mem::replace(&mut s, String::default());
+   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut s)`
+   |
+   = note: `-D clippy::mem-replace-with-default` implied by `-D warnings`
+
+error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take`
+  --> $DIR/mem_replace.rs:42:13
+   |
+LL |     let _ = std::mem::replace(s, String::default());
+   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(s)`
+
+error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take`
+  --> $DIR/mem_replace.rs:43:13
+   |
+LL |     let _ = std::mem::replace(s, Default::default());
+   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(s)`
+
+error: aborting due to 5 previous errors