File tree 2 files changed +22
-1
lines changed 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,18 @@ fn long_span() {
55
55
. collect ( ) ;
56
56
}
57
57
58
+ #[ allow( clippy:: useless_vec) ]
59
+ fn no_suggestion_if_comments_present ( ) {
60
+ let vec = vec ! [ vec![ 1 , 2 , 3 ] ] ;
61
+ let _ = vec
62
+ . iter ( )
63
+ // a lovely comment explaining the code in very detail
64
+ . map ( |x| x. iter ( ) )
65
+ //~^ ERROR: called `map(..).flatten()` on `Iterator`
66
+ // the answer to life, the universe and everything could be here
67
+ . flatten ( ) ;
68
+ }
69
+
58
70
fn main ( ) {
59
71
long_span ( ) ;
60
72
}
Original file line number Diff line number Diff line change @@ -102,5 +102,14 @@ LL + }
102
102
LL + })
103
103
|
104
104
105
- error: aborting due to 4 previous errors
105
+ error: called `map(..).flatten()` on `Iterator`
106
+ --> tests/ui/map_flatten.rs:64:10
107
+ |
108
+ LL | .map(|x| x.iter())
109
+ | __________^
110
+ ... |
111
+ LL | | .flatten();
112
+ | |__________________^ help: try replacing `map` with `flat_map` and remove the `.flatten()`: `flat_map(|x| x.iter())`
113
+
114
+ error: aborting due to 5 previous errors
106
115
You can’t perform that action at this time.
0 commit comments