File tree Expand file tree Collapse file tree 3 files changed +4
-10
lines changed
src/tools/clippy/tests/ui Expand file tree Collapse file tree 3 files changed +4
-10
lines changed Original file line number Diff line number Diff line change @@ -361,8 +361,8 @@ fn fn_call_in_nested_expr() {
361
361
let opt_foo = Some(Foo {
362
362
val: String::from("123"),
363
363
});
364
- //~v ERROR: function call inside of `unwrap_or `
365
- let _ = opt_foo.unwrap_or_else(|| Foo { val: String::default() });
364
+ // ok, `String::default()` is now `const `
365
+ let _ = opt_foo.unwrap_or( Foo { val: String::default() });
366
366
}
367
367
368
368
fn main() {}
Original file line number Diff line number Diff line change @@ -361,7 +361,7 @@ fn fn_call_in_nested_expr() {
361
361
let opt_foo = Some ( Foo {
362
362
val : String :: from ( "123" ) ,
363
363
} ) ;
364
- //~v ERROR: function call inside of `unwrap_or `
364
+ // ok, `String::default()` is now `const `
365
365
let _ = opt_foo. unwrap_or ( Foo { val : String :: default ( ) } ) ;
366
366
}
367
367
Original file line number Diff line number Diff line change @@ -238,11 +238,5 @@ 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: function call inside of `unwrap_or`
242
- --> tests/ui/or_fun_call.rs:365:21
243
- |
244
- LL | let _ = opt_foo.unwrap_or(Foo { val: String::default() });
245
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| Foo { val: String::default() })`
246
-
247
- error: aborting due to 38 previous errors
241
+ error: aborting due to 37 previous errors
248
242
You can’t perform that action at this time.
0 commit comments