File tree Expand file tree Collapse file tree 3 files changed +16
-3
lines changed Expand file tree Collapse file tree 3 files changed +16
-3
lines changed Original file line number Diff line number Diff line change
1
+ // run-rustfix
2
+ #![warn(clippy::all, clippy::pedantic)]
3
+ #![allow(clippy::iter_cloned_collect)]
4
+ #![allow(clippy::missing_docs_in_private_items)]
5
+
6
+ fn main() {
7
+ let _: Vec<i8> = vec![5_i8; 6].iter().cloned().collect();
8
+ let _: Vec<String> = vec![String::new()].iter().cloned().collect();
9
+ let _: Vec<u32> = vec![42, 43].iter().cloned().collect();
10
+ let _: Option<u64> = Some(Box::new(16)).map(|b| *b);
11
+ }
Original file line number Diff line number Diff line change
1
+ // run-rustfix
1
2
#![ warn( clippy:: all, clippy:: pedantic) ]
3
+ #![ allow( clippy:: iter_cloned_collect) ]
2
4
#![ allow( clippy:: missing_docs_in_private_items) ]
3
5
4
6
fn main ( ) {
Original file line number Diff line number Diff line change 1
1
error: You are using an explicit closure for cloning elements
2
- --> $DIR/map_clone.rs:5 :22
2
+ --> $DIR/map_clone.rs:7 :22
3
3
|
4
4
LL | let _: Vec<i8> = vec![5_i8; 6].iter().map(|x| *x).collect();
5
5
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Consider calling the dedicated `cloned` method: `vec![5_i8; 6].iter().cloned()`
6
6
|
7
7
= note: `-D clippy::map-clone` implied by `-D warnings`
8
8
9
9
error: You are using an explicit closure for cloning elements
10
- --> $DIR/map_clone.rs:6 :26
10
+ --> $DIR/map_clone.rs:8 :26
11
11
|
12
12
LL | let _: Vec<String> = vec![String::new()].iter().map(|x| x.clone()).collect();
13
13
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Consider calling the dedicated `cloned` method: `vec![String::new()].iter().cloned()`
14
14
15
15
error: You are using an explicit closure for cloning elements
16
- --> $DIR/map_clone.rs:7 :23
16
+ --> $DIR/map_clone.rs:9 :23
17
17
|
18
18
LL | let _: Vec<u32> = vec![42, 43].iter().map(|&x| x).collect();
19
19
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Consider calling the dedicated `cloned` method: `vec![42, 43].iter().cloned()`
You can’t perform that action at this time.
0 commit comments