From 4852cca61bb989adf77b1d202eae6b40067fa9ab Mon Sep 17 00:00:00 2001 From: "Samuel E. Moelius III" Date: Mon, 9 Nov 2020 07:49:14 -0500 Subject: [PATCH] Allow `let_underscore_drop` in `filter_methods` test --- tests/ui/filter_methods.rs | 1 + tests/ui/filter_methods.stderr | 55 ++++------------------------------ 2 files changed, 6 insertions(+), 50 deletions(-) diff --git a/tests/ui/filter_methods.rs b/tests/ui/filter_methods.rs index ef434245fd70..514502416192 100644 --- a/tests/ui/filter_methods.rs +++ b/tests/ui/filter_methods.rs @@ -1,4 +1,5 @@ #![warn(clippy::all, clippy::pedantic)] +#![allow(clippy::clippy::let_underscore_drop)] #![allow(clippy::missing_docs_in_private_items)] fn main() { diff --git a/tests/ui/filter_methods.stderr b/tests/ui/filter_methods.stderr index b5ac90282dc9..119226813793 100644 --- a/tests/ui/filter_methods.stderr +++ b/tests/ui/filter_methods.stderr @@ -1,14 +1,5 @@ -error: non-binding `let` on a type that implements `Drop` - --> $DIR/filter_methods.rs:5:5 - | -LL | let _: Vec<_> = vec![5; 6].into_iter().filter(|&x| x == 0).map(|x| x * 2).collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `-D clippy::let-underscore-drop` implied by `-D warnings` - = help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop` - error: called `filter(..).map(..)` on an `Iterator` - --> $DIR/filter_methods.rs:5:21 + --> $DIR/filter_methods.rs:6:21 | LL | let _: Vec<_> = vec![5; 6].into_iter().filter(|&x| x == 0).map(|x| x * 2).collect(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -16,20 +7,8 @@ LL | let _: Vec<_> = vec![5; 6].into_iter().filter(|&x| x == 0).map(|x| x * = note: `-D clippy::filter-map` implied by `-D warnings` = help: this is more succinctly expressed by calling `.filter_map(..)` instead -error: non-binding `let` on a type that implements `Drop` - --> $DIR/filter_methods.rs:7:5 - | -LL | / let _: Vec<_> = vec![5_i8; 6] -LL | | .into_iter() -LL | | .filter(|&x| x == 0) -LL | | .flat_map(|x| x.checked_mul(2)) -LL | | .collect(); - | |___________________^ - | - = help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop` - error: called `filter(..).flat_map(..)` on an `Iterator` - --> $DIR/filter_methods.rs:7:21 + --> $DIR/filter_methods.rs:8:21 | LL | let _: Vec<_> = vec![5_i8; 6] | _____________________^ @@ -40,20 +19,8 @@ LL | | .flat_map(|x| x.checked_mul(2)) | = help: this is more succinctly expressed by calling `.flat_map(..)` and filtering by returning `iter::empty()` -error: non-binding `let` on a type that implements `Drop` - --> $DIR/filter_methods.rs:13:5 - | -LL | / let _: Vec<_> = vec![5_i8; 6] -LL | | .into_iter() -LL | | .filter_map(|x| x.checked_mul(2)) -LL | | .flat_map(|x| x.checked_mul(2)) -LL | | .collect(); - | |___________________^ - | - = help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop` - error: called `filter_map(..).flat_map(..)` on an `Iterator` - --> $DIR/filter_methods.rs:13:21 + --> $DIR/filter_methods.rs:14:21 | LL | let _: Vec<_> = vec![5_i8; 6] | _____________________^ @@ -64,20 +31,8 @@ LL | | .flat_map(|x| x.checked_mul(2)) | = help: this is more succinctly expressed by calling `.flat_map(..)` and filtering by returning `iter::empty()` -error: non-binding `let` on a type that implements `Drop` - --> $DIR/filter_methods.rs:19:5 - | -LL | / let _: Vec<_> = vec![5_i8; 6] -LL | | .into_iter() -LL | | .filter_map(|x| x.checked_mul(2)) -LL | | .map(|x| x.checked_mul(2)) -LL | | .collect(); - | |___________________^ - | - = help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop` - error: called `filter_map(..).map(..)` on an `Iterator` - --> $DIR/filter_methods.rs:19:21 + --> $DIR/filter_methods.rs:20:21 | LL | let _: Vec<_> = vec![5_i8; 6] | _____________________^ @@ -88,5 +43,5 @@ LL | | .map(|x| x.checked_mul(2)) | = help: this is more succinctly expressed by only calling `.filter_map(..)` instead -error: aborting due to 8 previous errors +error: aborting due to 4 previous errors