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