|
1 | 1 | error: redundant closure
|
2 |
| - --> $DIR/eta.rs:32:27 |
| 2 | + --> $DIR/eta.rs:31:27 |
3 | 3 | |
|
4 | 4 | LL | let a = Some(1u8).map(|a| foo(a));
|
5 | 5 | | ^^^^^^^^^^ help: replace the closure with the function itself: `foo`
|
6 | 6 | |
|
7 | 7 | = note: `-D clippy::redundant-closure` implied by `-D warnings`
|
8 | 8 |
|
9 | 9 | error: redundant closure
|
10 |
| - --> $DIR/eta.rs:36:40 |
| 10 | + --> $DIR/eta.rs:35:40 |
11 | 11 | |
|
12 | 12 | LL | let _: Option<Vec<u8>> = true.then(|| vec![]); // special case vec!
|
13 | 13 | | ^^^^^^^^^ help: replace the closure with `Vec::new`: `std::vec::Vec::new`
|
14 | 14 |
|
15 | 15 | error: redundant closure
|
16 |
| - --> $DIR/eta.rs:37:35 |
| 16 | + --> $DIR/eta.rs:36:35 |
17 | 17 | |
|
18 | 18 | LL | let d = Some(1u8).map(|a| foo((|b| foo2(b))(a))); //is adjusted?
|
19 | 19 | | ^^^^^^^^^^^^^ help: replace the closure with the function itself: `foo2`
|
20 | 20 |
|
21 | 21 | error: this expression borrows a reference (`&u8`) that is immediately dereferenced by the compiler
|
22 |
| - --> $DIR/eta.rs:38:21 |
| 22 | + --> $DIR/eta.rs:37:21 |
23 | 23 | |
|
24 | 24 | LL | all(&[1, 2, 3], &&2, |x, y| below(x, y)); //is adjusted
|
25 | 25 | | ^^^ help: change this to: `&2`
|
26 | 26 | |
|
27 | 27 | = note: `-D clippy::needless-borrow` implied by `-D warnings`
|
28 | 28 |
|
29 | 29 | error: redundant closure
|
30 |
| - --> $DIR/eta.rs:38:26 |
| 30 | + --> $DIR/eta.rs:37:26 |
31 | 31 | |
|
32 | 32 | LL | all(&[1, 2, 3], &&2, |x, y| below(x, y)); //is adjusted
|
33 | 33 | | ^^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `below`
|
34 | 34 |
|
35 | 35 | error: redundant closure
|
36 |
| - --> $DIR/eta.rs:44:27 |
| 36 | + --> $DIR/eta.rs:43:27 |
37 | 37 | |
|
38 | 38 | LL | let e = Some(1u8).map(|a| divergent(a));
|
39 | 39 | | ^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `divergent`
|
40 | 40 |
|
41 | 41 | error: redundant closure
|
42 |
| - --> $DIR/eta.rs:45:27 |
| 42 | + --> $DIR/eta.rs:44:27 |
43 | 43 | |
|
44 | 44 | LL | let e = Some(1u8).map(|a| generic(a));
|
45 | 45 | | ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `generic`
|
46 | 46 |
|
47 | 47 | error: redundant closure
|
48 |
| - --> $DIR/eta.rs:91:51 |
| 48 | + --> $DIR/eta.rs:90:51 |
49 | 49 | |
|
50 | 50 | LL | let e = Some(TestStruct { some_ref: &i }).map(|a| a.foo());
|
51 | 51 | | ^^^^^^^^^^^ help: replace the closure with the method itself: `TestStruct::foo`
|
52 | 52 | |
|
53 | 53 | = note: `-D clippy::redundant-closure-for-method-calls` implied by `-D warnings`
|
54 | 54 |
|
55 | 55 | error: redundant closure
|
56 |
| - --> $DIR/eta.rs:92:51 |
| 56 | + --> $DIR/eta.rs:91:51 |
57 | 57 | |
|
58 | 58 | LL | let e = Some(TestStruct { some_ref: &i }).map(|a| a.trait_foo());
|
59 | 59 | | ^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `TestTrait::trait_foo`
|
60 | 60 |
|
61 | 61 | error: redundant closure
|
62 |
| - --> $DIR/eta.rs:94:42 |
| 62 | + --> $DIR/eta.rs:93:42 |
63 | 63 | |
|
64 | 64 | LL | let e = Some(&mut vec![1, 2, 3]).map(|v| v.clear());
|
65 | 65 | | ^^^^^^^^^^^^^ help: replace the closure with the method itself: `std::vec::Vec::clear`
|
66 | 66 |
|
67 | 67 | error: redundant closure
|
68 |
| - --> $DIR/eta.rs:98:29 |
| 68 | + --> $DIR/eta.rs:97:29 |
69 | 69 | |
|
70 | 70 | LL | let e = Some("str").map(|s| s.to_string());
|
71 | 71 | | ^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `std::string::ToString::to_string`
|
72 | 72 |
|
73 | 73 | error: redundant closure
|
74 |
| - --> $DIR/eta.rs:99:27 |
| 74 | + --> $DIR/eta.rs:98:27 |
75 | 75 | |
|
76 | 76 | LL | let e = Some('a').map(|s| s.to_uppercase());
|
77 | 77 | | ^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `char::to_uppercase`
|
78 | 78 |
|
79 | 79 | error: redundant closure
|
80 |
| - --> $DIR/eta.rs:101:65 |
| 80 | + --> $DIR/eta.rs:100:65 |
81 | 81 | |
|
82 | 82 | LL | let e: std::vec::Vec<char> = vec!['a', 'b', 'c'].iter().map(|c| c.to_ascii_uppercase()).collect();
|
83 | 83 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `char::to_ascii_uppercase`
|
84 | 84 |
|
85 | 85 | error: redundant closure
|
86 |
| - --> $DIR/eta.rs:164:22 |
| 86 | + --> $DIR/eta.rs:163:22 |
87 | 87 | |
|
88 | 88 | LL | requires_fn_once(|| x());
|
89 | 89 | | ^^^^^^ help: replace the closure with the function itself: `x`
|
90 | 90 |
|
91 | 91 | error: redundant closure
|
92 |
| - --> $DIR/eta.rs:171:27 |
| 92 | + --> $DIR/eta.rs:170:27 |
93 | 93 | |
|
94 | 94 | LL | let a = Some(1u8).map(|a| foo_ptr(a));
|
95 | 95 | | ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `foo_ptr`
|
96 | 96 |
|
97 | 97 | error: redundant closure
|
98 |
| - --> $DIR/eta.rs:176:27 |
| 98 | + --> $DIR/eta.rs:175:27 |
99 | 99 | |
|
100 | 100 | LL | let a = Some(1u8).map(|a| closure(a));
|
101 | 101 | | ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `closure`
|
102 | 102 |
|
103 | 103 | error: redundant closure
|
104 |
| - --> $DIR/eta.rs:208:28 |
| 104 | + --> $DIR/eta.rs:207:28 |
105 | 105 | |
|
106 | 106 | LL | x.into_iter().for_each(|x| add_to_res(x));
|
107 | 107 | | ^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `&mut add_to_res`
|
108 | 108 |
|
109 | 109 | error: redundant closure
|
110 |
| - --> $DIR/eta.rs:209:28 |
| 110 | + --> $DIR/eta.rs:208:28 |
111 | 111 | |
|
112 | 112 | LL | y.into_iter().for_each(|x| add_to_res(x));
|
113 | 113 | | ^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `&mut add_to_res`
|
114 | 114 |
|
115 | 115 | error: redundant closure
|
116 |
| - --> $DIR/eta.rs:210:28 |
| 116 | + --> $DIR/eta.rs:209:28 |
117 | 117 | |
|
118 | 118 | LL | z.into_iter().for_each(|x| add_to_res(x));
|
119 | 119 | | ^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `add_to_res`
|
120 | 120 |
|
121 | 121 | error: redundant closure
|
122 |
| - --> $DIR/eta.rs:217:21 |
| 122 | + --> $DIR/eta.rs:216:21 |
123 | 123 | |
|
124 | 124 | LL | Some(1).map(|n| closure(n));
|
125 | 125 | | ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `&mut closure`
|
126 | 126 |
|
127 | 127 | error: redundant closure
|
128 |
| - --> $DIR/eta.rs:236:21 |
| 128 | + --> $DIR/eta.rs:235:21 |
129 | 129 | |
|
130 | 130 | LL | map_str_to_path(|s| s.as_ref());
|
131 | 131 | | ^^^^^^^^^^^^^^ help: replace the closure with the method itself: `std::convert::AsRef::as_ref`
|
|
0 commit comments