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() {
406406 val: String::from("123"),
407407 });
408408
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() });
411411}
412412
413413mod result_map_or {
Original file line number Diff line number Diff line change @@ -406,8 +406,8 @@ fn fn_call_in_nested_expr() {
406406 val : String :: from ( "123" ) ,
407407 } ) ;
408408
409+ // ok, `String::default()` is now `const`
409410 let _ = opt_foo. unwrap_or ( Foo { val : String :: default ( ) } ) ;
410- //~^ or_fun_call
411411}
412412
413413mod 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
240240LL | let _ = opt.unwrap_or({ i32::default() });
241241 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
242242
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-
249243error: function call inside of `map_or`
250244 --> tests/ui/or_fun_call.rs:424:19
251245 |
@@ -264,5 +258,5 @@ error: function call inside of `get_or_insert`
264258LL | let _ = x.get_or_insert(g());
265259 | ^^^^^^^^^^^^^^^^^^ help: try: `get_or_insert_with(g)`
266260
267- error: aborting due to 41 previous errors
261+ error: aborting due to 40 previous errors
268262
You can’t perform that action at this time.
0 commit comments