]> git.lizzy.rs Git - rust.git/blob - tests/ui/methods.stderr
upgrade test to rust 2018
[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:41: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: called `map(f).unwrap_or(a)` on an Option value. This can be done more directly by calling `map_or(a, f)` instead
12   --> $DIR/methods.rs:171:13
13    |
14 LL |       let _ = opt.map(|x| x + 1)
15    |  _____________^
16 LL | |                 // Should lint even though this call is on a separate line.
17 LL | |                .unwrap_or(0);
18    | |____________________________^
19    |
20    = note: `-D clippy::option-map-unwrap-or` implied by `-D warnings`
21    = note: replace `map(|x| x + 1).unwrap_or(0)` with `map_or(0, |x| x + 1)`
22
23 error: called `map(f).unwrap_or(a)` on an Option value. This can be done more directly by calling `map_or(a, f)` instead
24   --> $DIR/methods.rs:175:13
25    |
26 LL |       let _ = opt.map(|x| {
27    |  _____________^
28 LL | |                         x + 1
29 LL | |                     }
30 LL | |               ).unwrap_or(0);
31    | |____________________________^
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:179:13
35    |
36 LL |       let _ = opt.map(|x| x + 1)
37    |  _____________^
38 LL | |                .unwrap_or({
39 LL | |                     0
40 LL | |                 });
41    | |__________________^
42
43 error: called `map(f).unwrap_or(None)` on an Option value. This can be done more directly by calling `and_then(f)` instead
44   --> $DIR/methods.rs:184:13
45    |
46 LL |     let _ = opt.map(|x| Some(x + 1)).unwrap_or(None);
47    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
48    |
49    = note: replace `map(|x| Some(x + 1)).unwrap_or(None)` with `and_then(|x| Some(x + 1))`
50
51 error: called `map(f).unwrap_or(None)` on an Option value. This can be done more directly by calling `and_then(f)` instead
52   --> $DIR/methods.rs:186:13
53    |
54 LL |       let _ = opt.map(|x| {
55    |  _____________^
56 LL | |         Some(x + 1)
57 LL | |     }
58 LL | |     ).unwrap_or(None);
59    | |_____________________^
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:190:13
63    |
64 LL |       let _ = opt
65    |  _____________^
66 LL | |         .map(|x| Some(x + 1))
67 LL | |         .unwrap_or(None);
68    | |________________________^
69    |
70    = note: replace `map(|x| Some(x + 1)).unwrap_or(None)` with `and_then(|x| Some(x + 1))`
71
72 error: called `map(f).unwrap_or(a)` on an Option value. This can be done more directly by calling `map_or(a, f)` instead
73   --> $DIR/methods.rs:201:13
74    |
75 LL |     let _ = Some("prefix").map(|p| format!("{}.", p)).unwrap_or(id);
76    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
77    |
78    = note: replace `map(|p| format!("{}.", p)).unwrap_or(id)` with `map_or(id, |p| format!("{}.", p))`
79
80 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
81   --> $DIR/methods.rs:205:13
82    |
83 LL |       let _ = opt.map(|x| x + 1)
84    |  _____________^
85 LL | |                 // Should lint even though this call is on a separate line.
86 LL | |                .unwrap_or_else(|| 0);
87    | |____________________________________^
88    |
89    = note: `-D clippy::option-map-unwrap-or-else` implied by `-D warnings`
90    = note: replace `map(|x| x + 1).unwrap_or_else(|| 0)` with `map_or_else(|| 0, |x| x + 1)`
91
92 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
93   --> $DIR/methods.rs:209:13
94    |
95 LL |       let _ = opt.map(|x| {
96    |  _____________^
97 LL | |                         x + 1
98 LL | |                     }
99 LL | |               ).unwrap_or_else(|| 0);
100    | |____________________________________^
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:213:13
104    |
105 LL |       let _ = opt.map(|x| x + 1)
106    |  _____________^
107 LL | |                .unwrap_or_else(||
108 LL | |                     0
109 LL | |                 );
110    | |_________________^
111
112 error: called `filter(p).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(p)` instead.
113   --> $DIR/methods.rs:243:13
114    |
115 LL |     let _ = v.iter().filter(|&x| *x < 0).next();
116    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
117    |
118    = note: `-D clippy::filter-next` implied by `-D warnings`
119    = note: replace `filter(|&x| *x < 0).next()` with `find(|&x| *x < 0)`
120
121 error: called `filter(p).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(p)` instead.
122   --> $DIR/methods.rs:246:13
123    |
124 LL |       let _ = v.iter().filter(|&x| {
125    |  _____________^
126 LL | |                                 *x < 0
127 LL | |                             }
128 LL | |                    ).next();
129    | |___________________________^
130
131 error: called `is_some()` after searching an `Iterator` with find. This is more succinctly expressed by calling `any()`.
132   --> $DIR/methods.rs:262:13
133    |
134 LL |     let _ = v.iter().find(|&x| *x < 0).is_some();
135    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
136    |
137    = note: `-D clippy::search-is-some` implied by `-D warnings`
138    = note: replace `find(|&x| *x < 0).is_some()` with `any(|x| *x < 0)`
139
140 error: called `is_some()` after searching an `Iterator` with find. This is more succinctly expressed by calling `any()`.
141   --> $DIR/methods.rs:265:13
142    |
143 LL |       let _ = v.iter().find(|&x| {
144    |  _____________^
145 LL | |                               *x < 0
146 LL | |                           }
147 LL | |                    ).is_some();
148    | |______________________________^
149
150 error: called `is_some()` after searching an `Iterator` with position. This is more succinctly expressed by calling `any()`.
151   --> $DIR/methods.rs:271:13
152    |
153 LL |     let _ = v.iter().position(|&x| x < 0).is_some();
154    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
155    |
156    = note: replace `position(|&x| x < 0).is_some()` with `any(|&x| x < 0)`
157
158 error: called `is_some()` after searching an `Iterator` with position. This is more succinctly expressed by calling `any()`.
159   --> $DIR/methods.rs:274:13
160    |
161 LL |       let _ = v.iter().position(|&x| {
162    |  _____________^
163 LL | |                                   x < 0
164 LL | |                               }
165 LL | |                    ).is_some();
166    | |______________________________^
167
168 error: called `is_some()` after searching an `Iterator` with rposition. This is more succinctly expressed by calling `any()`.
169   --> $DIR/methods.rs:280:13
170    |
171 LL |     let _ = v.iter().rposition(|&x| x < 0).is_some();
172    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
173    |
174    = note: replace `rposition(|&x| x < 0).is_some()` with `any(|&x| x < 0)`
175
176 error: called `is_some()` after searching an `Iterator` with rposition. This is more succinctly expressed by calling `any()`.
177   --> $DIR/methods.rs:283:13
178    |
179 LL |       let _ = v.iter().rposition(|&x| {
180    |  _____________^
181 LL | |                                    x < 0
182 LL | |                                }
183 LL | |                    ).is_some();
184    | |______________________________^
185
186 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
187   --> $DIR/methods.rs:298:13
188    |
189 LL |     let _ = opt.unwrap();
190    |             ^^^^^^^^^^^^
191    |
192    = note: `-D clippy::option-unwrap-used` implied by `-D warnings`
193
194 error: aborting due to 20 previous errors
195