Use 'span_lint_and_sugg'
This commit is contained in:
parent
3a65e4e75a
commit
d51136d594
3 changed files with 21 additions and 11 deletions
|
|
@ -1,3 +1,5 @@
|
|||
// run-rustfix
|
||||
|
||||
#![warn(clippy::flat_map_identity)]
|
||||
|
||||
use std::convert;
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
error: called `flat_map(|x| x)` on an `Iterator`. This can be simplified by calling `flatten().`
|
||||
--> $DIR/unnecessary_flat_map.rs:7:5
|
||||
error: called `flat_map(|x| x)` on an `Iterator`
|
||||
--> $DIR/unnecessary_flat_map.rs:9:14
|
||||
|
|
||||
LL | iterator.flat_map(|x| x);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
| ^^^^^^^^^^^^^^^ help: try: `flatten()`
|
||||
|
|
||||
= note: `-D clippy::flat-map-identity` implied by `-D warnings`
|
||||
|
||||
error: called `flat_map(std::convert::identity)` on an `Iterator`. This can be simplified by calling `flatten().`
|
||||
--> $DIR/unnecessary_flat_map.rs:10:23
|
||||
error: called `flat_map(std::convert::identity)` on an `Iterator`
|
||||
--> $DIR/unnecessary_flat_map.rs:12:14
|
||||
|
|
||||
LL | iterator.flat_map(convert::identity);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `flatten()`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue