fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
1.9 KiB41 linesraw
1error: you are using an explicit closure for copying elements
2  --> $DIR/map_clone.rs:11:22
3   |
4LL |     let _: Vec<i8> = vec![5_i8; 6].iter().map(|x| *x).collect();
5   |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `copied` method: `vec![5_i8; 6].iter().copied()`
6   |
7   = note: `-D clippy::map-clone` implied by `-D warnings`
8   = help: to override `-D warnings` add `#[allow(clippy::map_clone)]`
9
10error: you are using an explicit closure for cloning elements
11  --> $DIR/map_clone.rs:12:26
12   |
13LL |     let _: Vec<String> = vec![String::new()].iter().map(|x| x.clone()).collect();
14   |                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `cloned` method: `vec![String::new()].iter().cloned()`
15
16error: you are using an explicit closure for copying elements
17  --> $DIR/map_clone.rs:13:23
18   |
19LL |     let _: Vec<u32> = vec![42, 43].iter().map(|&x| x).collect();
20   |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `copied` method: `vec![42, 43].iter().copied()`
21
22error: you are using an explicit closure for copying elements
23  --> $DIR/map_clone.rs:15:26
24   |
25LL |     let _: Option<u64> = Some(&16).map(|b| *b);
26   |                          ^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `copied` method: `Some(&16).copied()`
27
28error: you are using an explicit closure for copying elements
29  --> $DIR/map_clone.rs:16:25
30   |
31LL |     let _: Option<u8> = Some(&1).map(|x| x.clone());
32   |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `copied` method: `Some(&1).copied()`
33
34error: you are needlessly cloning iterator elements
35  --> $DIR/map_clone.rs:27:29
36   |
37LL |     let _ = std::env::args().map(|v| v.clone());
38   |                             ^^^^^^^^^^^^^^^^^^^ help: remove the `map` call
39
40error: aborting due to 6 previous errors
41