diff options
Diffstat (limited to 'src/docs/mem_replace_with_default.txt')
| -rw-r--r-- | src/docs/mem_replace_with_default.txt | 18 |
1 files changed, 0 insertions, 18 deletions
diff --git a/src/docs/mem_replace_with_default.txt b/src/docs/mem_replace_with_default.txt deleted file mode 100644 index 24e0913a30c..00000000000 --- a/src/docs/mem_replace_with_default.txt +++ /dev/null @@ -1,18 +0,0 @@ -### What it does -Checks for `std::mem::replace` on a value of type -`T` with `T::default()`. - -### Why is this bad? -`std::mem` module already has the method `take` to -take the current value and replace it with the default value of that type. - -### Example -``` -let mut text = String::from("foo"); -let replaced = std::mem::replace(&mut text, String::default()); -``` -Is better expressed with: -``` -let mut text = String::from("foo"); -let taken = std::mem::take(&mut text); -``` \ No newline at end of file |
