1- error: redundant closure found
1+ error: redundant closure
22 --> $DIR/eta.rs:32:27
33 |
44LL | 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`
66 |
77 = note: `-D clippy::redundant-closure` implied by `-D warnings`
88
9- error: redundant closure found
9+ error: redundant closure
1010 --> $DIR/eta.rs:33:10
1111 |
1212LL | meta(|a| foo(a));
13- | ^^^^^^^^^^ help: remove closure as shown : `foo`
13+ | ^^^^^^^^^^ help: replace the closure with the function itself : `foo`
1414
15- error: redundant closure found
15+ error: redundant closure
1616 --> $DIR/eta.rs:37:40
1717 |
1818LL | 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`
2020
2121error: this expression borrows a reference (`&u8`) that is immediately dereferenced by the compiler
2222 --> $DIR/eta.rs:39:21
@@ -26,61 +26,61 @@ LL | all(&[1, 2, 3], &&2, |x, y| below(x, y)); //is adjusted
2626 |
2727 = note: `-D clippy::needless-borrow` implied by `-D warnings`
2828
29- error: redundant closure found
29+ error: redundant closure
3030 --> $DIR/eta.rs:46:27
3131 |
3232LL | 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`
3434
35- error: redundant closure found
35+ error: redundant closure
3636 --> $DIR/eta.rs:89:51
3737 |
3838LL | 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`
4040 |
4141 = note: `-D clippy::redundant-closure-for-method-calls` implied by `-D warnings`
4242
43- error: redundant closure found
43+ error: redundant closure
4444 --> $DIR/eta.rs:91:51
4545 |
4646LL | 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`
4848
49- error: redundant closure found
49+ error: redundant closure
5050 --> $DIR/eta.rs:94:42
5151 |
5252LL | 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`
5454
55- error: redundant closure found
55+ error: redundant closure
5656 --> $DIR/eta.rs:99:29
5757 |
5858LL | 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`
6060
61- error: redundant closure found
61+ error: redundant closure
6262 --> $DIR/eta.rs:101:27
6363 |
6464LL | 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`
6666
67- error: redundant closure found
67+ error: redundant closure
6868 --> $DIR/eta.rs:104:65
6969 |
7070LL | 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`
7272
73- error: redundant closure found
73+ error: redundant closure
7474 --> $DIR/eta.rs:187:27
7575 |
7676LL | 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`
7878
79- error: redundant closure found
79+ error: redundant closure
8080 --> $DIR/eta.rs:192:27
8181 |
8282LL | 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`
8484
8585error: aborting due to 13 previous errors
8686
0 commit comments