1
- error: use of `unwrap_or` followed by a function call
1
+ error: function call inside of `unwrap_or`
2
2
--> tests/ui/or_fun_call.rs:52:22
3
3
|
4
4
LL | with_constructor.unwrap_or(make());
@@ -16,19 +16,19 @@ LL | with_new.unwrap_or(Vec::new());
16
16
= note: `-D clippy::unwrap-or-default` implied by `-D warnings`
17
17
= help: to override `-D warnings` add `#[allow(clippy::unwrap_or_default)]`
18
18
19
- error: use of `unwrap_or` followed by a function call
19
+ error: function call inside of `unwrap_or`
20
20
--> tests/ui/or_fun_call.rs:58:21
21
21
|
22
22
LL | with_const_args.unwrap_or(Vec::with_capacity(12));
23
23
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| Vec::with_capacity(12))`
24
24
25
- error: use of `unwrap_or` followed by a function call
25
+ error: function call inside of `unwrap_or`
26
26
--> tests/ui/or_fun_call.rs:61:14
27
27
|
28
28
LL | with_err.unwrap_or(make());
29
29
| ^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|_| make())`
30
30
31
- error: use of `unwrap_or` followed by a function call
31
+ error: function call inside of `unwrap_or`
32
32
--> tests/ui/or_fun_call.rs:64:19
33
33
|
34
34
LL | with_err_args.unwrap_or(Vec::with_capacity(12));
@@ -46,7 +46,7 @@ error: use of `unwrap_or` to construct default value
46
46
LL | with_default_type.unwrap_or(u64::default());
47
47
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
48
48
49
- error: use of `unwrap_or` followed by a function call
49
+ error: function call inside of `unwrap_or`
50
50
--> tests/ui/or_fun_call.rs:73:18
51
51
|
52
52
LL | self_default.unwrap_or(<FakeDefault>::default());
@@ -64,7 +64,7 @@ error: use of `unwrap_or` to construct default value
64
64
LL | with_vec.unwrap_or(vec![]);
65
65
| ^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
66
66
67
- error: use of `unwrap_or` followed by a function call
67
+ error: function call inside of `unwrap_or`
68
68
--> tests/ui/or_fun_call.rs:82:21
69
69
|
70
70
LL | without_default.unwrap_or(Foo::new());
@@ -100,55 +100,55 @@ error: use of `unwrap_or` to construct default value
100
100
LL | let _ = stringy.unwrap_or(String::new());
101
101
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
102
102
103
- error: use of `ok_or` followed by a function call
103
+ error: function call inside of `ok_or`
104
104
--> tests/ui/or_fun_call.rs:101:17
105
105
|
106
106
LL | let _ = opt.ok_or(format!("{} world.", hello));
107
107
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `ok_or_else(|| format!("{} world.", hello))`
108
108
109
- error: use of `unwrap_or` followed by a function call
109
+ error: function call inside of `unwrap_or`
110
110
--> tests/ui/or_fun_call.rs:105:21
111
111
|
112
112
LL | let _ = Some(1).unwrap_or(map[&1]);
113
113
| ^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| map[&1])`
114
114
115
- error: use of `unwrap_or` followed by a function call
115
+ error: function call inside of `unwrap_or`
116
116
--> tests/ui/or_fun_call.rs:107:21
117
117
|
118
118
LL | let _ = Some(1).unwrap_or(map[&1]);
119
119
| ^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| map[&1])`
120
120
121
- error: use of `or` followed by a function call
121
+ error: function call inside of `or`
122
122
--> tests/ui/or_fun_call.rs:131:35
123
123
|
124
124
LL | let _ = Some("a".to_string()).or(Some("b".to_string()));
125
125
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `or_else(|| Some("b".to_string()))`
126
126
127
- error: use of `unwrap_or` followed by a function call
127
+ error: function call inside of `unwrap_or`
128
128
--> tests/ui/or_fun_call.rs:170:14
129
129
|
130
130
LL | None.unwrap_or(ptr_to_ref(s));
131
131
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| ptr_to_ref(s))`
132
132
133
- error: use of `unwrap_or` followed by a function call
133
+ error: function call inside of `unwrap_or`
134
134
--> tests/ui/or_fun_call.rs:176:14
135
135
|
136
136
LL | None.unwrap_or(unsafe { ptr_to_ref(s) });
137
137
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| unsafe { ptr_to_ref(s) })`
138
138
139
- error: use of `unwrap_or` followed by a function call
139
+ error: function call inside of `unwrap_or`
140
140
--> tests/ui/or_fun_call.rs:178:14
141
141
|
142
142
LL | None.unwrap_or( unsafe { ptr_to_ref(s) } );
143
143
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| unsafe { ptr_to_ref(s) })`
144
144
145
- error: use of `map_or` followed by a function call
145
+ error: function call inside of `map_or`
146
146
--> tests/ui/or_fun_call.rs:253:25
147
147
|
148
148
LL | let _ = Some(4).map_or(g(), |v| v);
149
149
| ^^^^^^^^^^^^^^^^^^ help: try: `map_or_else(g, |v| v)`
150
150
151
- error: use of `map_or` followed by a function call
151
+ error: function call inside of `map_or`
152
152
--> tests/ui/or_fun_call.rs:254:25
153
153
|
154
154
LL | let _ = Some(4).map_or(g(), f);
@@ -196,19 +196,19 @@ error: use of `unwrap_or_else` to construct default value
196
196
LL | let _ = stringy.unwrap_or_else(String::new);
197
197
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
198
198
199
- error: use of `unwrap_or` followed by a function call
199
+ error: function call inside of `unwrap_or`
200
200
--> tests/ui/or_fun_call.rs:345:17
201
201
|
202
202
LL | let _ = opt.unwrap_or({ f() }); // suggest `.unwrap_or_else(f)`
203
203
| ^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(f)`
204
204
205
- error: use of `unwrap_or` followed by a function call
205
+ error: function call inside of `unwrap_or`
206
206
--> tests/ui/or_fun_call.rs:348:17
207
207
|
208
208
LL | let _ = opt.unwrap_or(f() + 1); // suggest `.unwrap_or_else(|| f() + 1)`
209
209
| ^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| f() + 1)`
210
210
211
- error: use of `unwrap_or` followed by a function call
211
+ error: function call inside of `unwrap_or`
212
212
--> tests/ui/or_fun_call.rs:351:17
213
213
|
214
214
LL | let _ = opt.unwrap_or({
@@ -226,7 +226,7 @@ LL + x + 1
226
226
LL ~ });
227
227
|
228
228
229
- error: use of `map_or` followed by a function call
229
+ error: function call inside of `map_or`
230
230
--> tests/ui/or_fun_call.rs:356:17
231
231
|
232
232
LL | let _ = opt.map_or(f() + 1, |v| v); // suggest `.map_or_else(|| f() + 1, |v| v)`
@@ -238,7 +238,7 @@ error: use of `unwrap_or` to construct default value
238
238
LL | let _ = opt.unwrap_or({ i32::default() });
239
239
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
240
240
241
- error: use of `unwrap_or` followed by a function call
241
+ error: function call inside of `unwrap_or`
242
242
--> tests/ui/or_fun_call.rs:365:21
243
243
|
244
244
LL | let _ = opt_foo.unwrap_or(Foo { val: String::default() });
0 commit comments