1
- error: redundant closure found
1
+ error: redundant closure
2
2
--> $DIR/eta.rs:32:27
3
3
|
4
4
LL | let a = Some(1u8).map(|a| foo(a));
5
- | ^^^^^^^^^^ help: remove closure as shown : `foo`
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
- error: redundant closure found
9
+ error: redundant closure
10
10
--> $DIR/eta.rs:33:10
11
11
|
12
12
LL | meta(|a| foo(a));
13
- | ^^^^^^^^^^ help: remove closure as shown : `foo`
13
+ | ^^^^^^^^^^ help: replace the closure with the function itself : `foo`
14
14
15
- error: redundant closure found
15
+ error: redundant closure
16
16
--> $DIR/eta.rs:37:40
17
17
|
18
18
LL | let _: Option<Vec<u8>> = true.then(|| vec![]); // special case vec!
19
- | ^^^^^^^^^ help: remove closure as shown : `std::vec::Vec::new`
19
+ | ^^^^^^^^^ help: replace the closure with `Vec::new` : `std::vec::Vec::new`
20
20
21
21
error: this expression borrows a reference (`&u8`) that is immediately dereferenced by the compiler
22
22
--> $DIR/eta.rs:39:21
@@ -26,61 +26,61 @@ LL | all(&[1, 2, 3], &&2, |x, y| below(x, y)); //is adjusted
26
26
|
27
27
= note: `-D clippy::needless-borrow` implied by `-D warnings`
28
28
29
- error: redundant closure found
29
+ error: redundant closure
30
30
--> $DIR/eta.rs:46:27
31
31
|
32
32
LL | let e = Some(1u8).map(|a| generic(a));
33
- | ^^^^^^^^^^^^^^ help: remove closure as shown : `generic`
33
+ | ^^^^^^^^^^^^^^ help: replace the closure with the function itself : `generic`
34
34
35
- error: redundant closure found
35
+ error: redundant closure
36
36
--> $DIR/eta.rs:89:51
37
37
|
38
38
LL | let e = Some(TestStruct { some_ref: &i }).map(|a| a.foo());
39
- | ^^^^^^^^^^^ help: remove closure as shown : `TestStruct::foo`
39
+ | ^^^^^^^^^^^ help: replace the closure with the method itself : `TestStruct::foo`
40
40
|
41
41
= note: `-D clippy::redundant-closure-for-method-calls` implied by `-D warnings`
42
42
43
- error: redundant closure found
43
+ error: redundant closure
44
44
--> $DIR/eta.rs:91:51
45
45
|
46
46
LL | let e = Some(TestStruct { some_ref: &i }).map(|a| a.trait_foo());
47
- | ^^^^^^^^^^^^^^^^^ help: remove closure as shown : `TestTrait::trait_foo`
47
+ | ^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself : `TestTrait::trait_foo`
48
48
49
- error: redundant closure found
49
+ error: redundant closure
50
50
--> $DIR/eta.rs:94:42
51
51
|
52
52
LL | let e = Some(&mut vec![1, 2, 3]).map(|v| v.clear());
53
- | ^^^^^^^^^^^^^ help: remove closure as shown : `std::vec::Vec::clear`
53
+ | ^^^^^^^^^^^^^ help: replace the closure with the method itself : `std::vec::Vec::clear`
54
54
55
- error: redundant closure found
55
+ error: redundant closure
56
56
--> $DIR/eta.rs:99:29
57
57
|
58
58
LL | let e = Some("str").map(|s| s.to_string());
59
- | ^^^^^^^^^^^^^^^^^ help: remove closure as shown : `std::string::ToString::to_string`
59
+ | ^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself : `std::string::ToString::to_string`
60
60
61
- error: redundant closure found
61
+ error: redundant closure
62
62
--> $DIR/eta.rs:101:27
63
63
|
64
64
LL | let e = Some('a').map(|s| s.to_uppercase());
65
- | ^^^^^^^^^^^^^^^^^^^^ help: remove closure as shown : `char::to_uppercase`
65
+ | ^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself : `char::to_uppercase`
66
66
67
- error: redundant closure found
67
+ error: redundant closure
68
68
--> $DIR/eta.rs:104:65
69
69
|
70
70
LL | let e: std::vec::Vec<char> = vec!['a', 'b', 'c'].iter().map(|c| c.to_ascii_uppercase()).collect();
71
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove closure as shown : `char::to_ascii_uppercase`
71
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself : `char::to_ascii_uppercase`
72
72
73
- error: redundant closure found
73
+ error: redundant closure
74
74
--> $DIR/eta.rs:187:27
75
75
|
76
76
LL | let a = Some(1u8).map(|a| foo_ptr(a));
77
- | ^^^^^^^^^^^^^^ help: remove closure as shown : `foo_ptr`
77
+ | ^^^^^^^^^^^^^^ help: replace the closure with the function itself : `foo_ptr`
78
78
79
- error: redundant closure found
79
+ error: redundant closure
80
80
--> $DIR/eta.rs:192:27
81
81
|
82
82
LL | let a = Some(1u8).map(|a| closure(a));
83
- | ^^^^^^^^^^^^^^ help: remove closure as shown : `closure`
83
+ | ^^^^^^^^^^^^^^ help: replace the closure with the function itself : `closure`
84
84
85
85
error: aborting due to 13 previous errors
86
86
0 commit comments