]> git.lizzy.rs Git - rust.git/blob - tests/ui/methods.stderr
use a structured suggestion for char-lit-as-u8
[rust.git] / tests / ui / methods.stderr
1 error: defining a method called `add` on this type; consider implementing the `std::ops::Add` trait or choosing a less ambiguous name
2   --> $DIR/methods.rs:36:5
3    |
4 LL | /     pub fn add(self, other: T) -> T {
5 LL | |         self
6 LL | |     }
7    | |_____^
8    |
9    = note: `-D clippy::should-implement-trait` implied by `-D warnings`
10
11 error: methods called `new` usually return `Self`
12   --> $DIR/methods.rs:152:5
13    |
14 LL | /     fn new() -> i32 {
15 LL | |         0
16 LL | |     }
17    | |_____^
18    |
19    = note: `-D clippy::new-ret-no-self` implied by `-D warnings`
20
21 error: called `map(f).unwrap_or(a)` on an Option value. This can be done more directly by calling `map_or(a, f)` instead
22   --> $DIR/methods.rs:174:13
23    |
24 LL |       let _ = opt.map(|x| x + 1)
25    |  _____________^
26 LL | |                 // Should lint even though this call is on a separate line.
27 LL | |                .unwrap_or(0);
28    | |____________________________^
29    |
30    = note: `-D clippy::option-map-unwrap-or` implied by `-D warnings`
31    = note: replace `map(|x| x + 1).unwrap_or(0)` with `map_or(0, |x| x + 1)`
32
33 error: called `map(f).unwrap_or(a)` on an Option value. This can be done more directly by calling `map_or(a, f)` instead
34   --> $DIR/methods.rs:178:13
35    |
36 LL |       let _ = opt.map(|x| {
37    |  _____________^
38 LL | |                         x + 1
39 LL | |                     }
40 LL | |               ).unwrap_or(0);
41    | |____________________________^
42
43 error: called `map(f).unwrap_or(a)` on an Option value. This can be done more directly by calling `map_or(a, f)` instead
44   --> $DIR/methods.rs:182:13
45    |
46 LL |       let _ = opt.map(|x| x + 1)
47    |  _____________^
48 LL | |                .unwrap_or({
49 LL | |                     0
50 LL | |                 });
51    | |__________________^
52
53 error: called `map(f).unwrap_or(None)` on an Option value. This can be done more directly by calling `and_then(f)` instead
54   --> $DIR/methods.rs:187:13
55    |
56 LL |     let _ = opt.map(|x| Some(x + 1)).unwrap_or(None);
57    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
58    |
59    = note: replace `map(|x| Some(x + 1)).unwrap_or(None)` with `and_then(|x| Some(x + 1))`
60
61 error: called `map(f).unwrap_or(None)` on an Option value. This can be done more directly by calling `and_then(f)` instead
62   --> $DIR/methods.rs:189:13
63    |
64 LL |       let _ = opt.map(|x| {
65    |  _____________^
66 LL | |         Some(x + 1)
67 LL | |     }
68 LL | |     ).unwrap_or(None);
69    | |_____________________^
70
71 error: called `map(f).unwrap_or(None)` on an Option value. This can be done more directly by calling `and_then(f)` instead
72   --> $DIR/methods.rs:193:13
73    |
74 LL |       let _ = opt
75    |  _____________^
76 LL | |         .map(|x| Some(x + 1))
77 LL | |         .unwrap_or(None);
78    | |________________________^
79    |
80    = note: replace `map(|x| Some(x + 1)).unwrap_or(None)` with `and_then(|x| Some(x + 1))`
81
82 error: called `map(f).unwrap_or(a)` on an Option value. This can be done more directly by calling `map_or(a, f)` instead
83   --> $DIR/methods.rs:204:13
84    |
85 LL |     let _ = Some("prefix").map(|p| format!("{}.", p)).unwrap_or(id);
86    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
87    |
88    = note: replace `map(|p| format!("{}.", p)).unwrap_or(id)` with `map_or(id, |p| format!("{}.", p))`
89
90 error: called `map(f).unwrap_or_else(g)` on an Option value. This can be done more directly by calling `map_or_else(g, f)` instead
91   --> $DIR/methods.rs:208:13
92    |
93 LL |       let _ = opt.map(|x| x + 1)
94    |  _____________^
95 LL | |                 // Should lint even though this call is on a separate line.
96 LL | |                .unwrap_or_else(|| 0);
97    | |____________________________________^
98    |
99    = note: `-D clippy::option-map-unwrap-or-else` implied by `-D warnings`
100    = note: replace `map(|x| x + 1).unwrap_or_else(|| 0)` with `map_or_else(|| 0, |x| x + 1)`
101
102 error: called `map(f).unwrap_or_else(g)` on an Option value. This can be done more directly by calling `map_or_else(g, f)` instead
103   --> $DIR/methods.rs:212:13
104    |
105 LL |       let _ = opt.map(|x| {
106    |  _____________^
107 LL | |                         x + 1
108 LL | |                     }
109 LL | |               ).unwrap_or_else(|| 0);
110    | |____________________________________^
111
112 error: called `map(f).unwrap_or_else(g)` on an Option value. This can be done more directly by calling `map_or_else(g, f)` instead
113   --> $DIR/methods.rs:216:13
114    |
115 LL |       let _ = opt.map(|x| x + 1)
116    |  _____________^
117 LL | |                .unwrap_or_else(||
118 LL | |                     0
119 LL | |                 );
120    | |_________________^
121
122 error: called `filter(p).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(p)` instead.
123   --> $DIR/methods.rs:246:13
124    |
125 LL |     let _ = v.iter().filter(|&x| *x < 0).next();
126    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
127    |
128    = note: `-D clippy::filter-next` implied by `-D warnings`
129    = note: replace `filter(|&x| *x < 0).next()` with `find(|&x| *x < 0)`
130
131 error: called `filter(p).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(p)` instead.
132   --> $DIR/methods.rs:249:13
133    |
134 LL |       let _ = v.iter().filter(|&x| {
135    |  _____________^
136 LL | |                                 *x < 0
137 LL | |                             }
138 LL | |                    ).next();
139    | |___________________________^
140
141 error: called `is_some()` after searching an `Iterator` with find. This is more succinctly expressed by calling `any()`.
142   --> $DIR/methods.rs:265:13
143    |
144 LL |     let _ = v.iter().find(|&x| *x < 0).is_some();
145    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
146    |
147    = note: `-D clippy::search-is-some` implied by `-D warnings`
148    = note: replace `find(|&x| *x < 0).is_some()` with `any(|x| *x < 0)`
149
150 error: called `is_some()` after searching an `Iterator` with find. This is more succinctly expressed by calling `any()`.
151   --> $DIR/methods.rs:268:13
152    |
153 LL |       let _ = v.iter().find(|&x| {
154    |  _____________^
155 LL | |                               *x < 0
156 LL | |                           }
157 LL | |                    ).is_some();
158    | |______________________________^
159
160 error: called `is_some()` after searching an `Iterator` with position. This is more succinctly expressed by calling `any()`.
161   --> $DIR/methods.rs:274:13
162    |
163 LL |     let _ = v.iter().position(|&x| x < 0).is_some();
164    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
165    |
166    = note: replace `position(|&x| x < 0).is_some()` with `any(|&x| x < 0)`
167
168 error: called `is_some()` after searching an `Iterator` with position. This is more succinctly expressed by calling `any()`.
169   --> $DIR/methods.rs:277:13
170    |
171 LL |       let _ = v.iter().position(|&x| {
172    |  _____________^
173 LL | |                                   x < 0
174 LL | |                               }
175 LL | |                    ).is_some();
176    | |______________________________^
177
178 error: called `is_some()` after searching an `Iterator` with rposition. This is more succinctly expressed by calling `any()`.
179   --> $DIR/methods.rs:283:13
180    |
181 LL |     let _ = v.iter().rposition(|&x| x < 0).is_some();
182    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
183    |
184    = note: replace `rposition(|&x| x < 0).is_some()` with `any(|&x| x < 0)`
185
186 error: called `is_some()` after searching an `Iterator` with rposition. This is more succinctly expressed by calling `any()`.
187   --> $DIR/methods.rs:286:13
188    |
189 LL |       let _ = v.iter().rposition(|&x| {
190    |  _____________^
191 LL | |                                    x < 0
192 LL | |                                }
193 LL | |                    ).is_some();
194    | |______________________________^
195
196 error: used unwrap() on an Option value. If you don't want to handle the None case gracefully, consider using expect() to provide a better panic message
197   --> $DIR/methods.rs:301:13
198    |
199 LL |     let _ = opt.unwrap();
200    |             ^^^^^^^^^^^^
201    |
202    = note: `-D clippy::option-unwrap-used` implied by `-D warnings`
203
204 error: aborting due to 21 previous errors
205