File tree Expand file tree Collapse file tree 3 files changed +4
-10
lines changed Expand file tree Collapse file tree 3 files changed +4
-10
lines changed Original file line number Diff line number Diff line change @@ -406,8 +406,8 @@ fn fn_call_in_nested_expr() {
406
406
val: String::from("123"),
407
407
});
408
408
409
- let _ = opt_foo.unwrap_or_else(|| Foo { val: String::default() });
410
- //~^ or_fun_call
409
+ // ok, ` String::default()` is now `const`
410
+ let _ = opt_foo.unwrap_or(Foo { val: String::default() });
411
411
}
412
412
413
413
mod result_map_or {
Original file line number Diff line number Diff line change @@ -406,8 +406,8 @@ fn fn_call_in_nested_expr() {
406
406
val : String :: from ( "123" ) ,
407
407
} ) ;
408
408
409
+ // ok, `String::default()` is now `const`
409
410
let _ = opt_foo. unwrap_or ( Foo { val : String :: default ( ) } ) ;
410
- //~^ or_fun_call
411
411
}
412
412
413
413
mod result_map_or {
Original file line number Diff line number Diff line change @@ -240,12 +240,6 @@ error: use of `unwrap_or` to construct default value
240
240
LL | let _ = opt.unwrap_or({ i32::default() });
241
241
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
242
242
243
- error: function call inside of `unwrap_or`
244
- --> tests/ui/or_fun_call.rs:409:21
245
- |
246
- LL | let _ = opt_foo.unwrap_or(Foo { val: String::default() });
247
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| Foo { val: String::default() })`
248
-
249
243
error: function call inside of `map_or`
250
244
--> tests/ui/or_fun_call.rs:424:19
251
245
|
@@ -264,5 +258,5 @@ error: function call inside of `get_or_insert`
264
258
LL | let _ = x.get_or_insert(g());
265
259
| ^^^^^^^^^^^^^^^^^^ help: try: `get_or_insert_with(g)`
266
260
267
- error: aborting due to 41 previous errors
261
+ error: aborting due to 40 previous errors
268
262
You can’t perform that action at this time.
0 commit comments