diff options
Diffstat (limited to 'src/tools/clippy/src/docs/manual_retain.txt')
-rw-r--r-- | src/tools/clippy/src/docs/manual_retain.txt | 15 |
1 files changed, 0 insertions, 15 deletions
diff --git a/src/tools/clippy/src/docs/manual_retain.txt b/src/tools/clippy/src/docs/manual_retain.txt deleted file mode 100644 index cd4f65a93..000000000 --- a/src/tools/clippy/src/docs/manual_retain.txt +++ /dev/null @@ -1,15 +0,0 @@ -### What it does -Checks for code to be replaced by `.retain()`. -### Why is this bad? -`.retain()` is simpler and avoids needless allocation. -### Example -``` -let mut vec = vec![0, 1, 2]; -vec = vec.iter().filter(|&x| x % 2 == 0).copied().collect(); -vec = vec.into_iter().filter(|x| x % 2 == 0).collect(); -``` -Use instead: -``` -let mut vec = vec![0, 1, 2]; -vec.retain(|x| x % 2 == 0); -```
\ No newline at end of file |