Skip to content

Commit 7795f95

Browse files
committed
[double check] update clippy test
The lint should likely still trigger while the const Default impl is unstable.
1 parent 78db9d1 commit 7795f95

File tree

3 files changed

+4
-10
lines changed

3 files changed

+4
-10
lines changed

‎src/tools/clippy/tests/ui/or_fun_call.fixed

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,8 +361,8 @@ fn fn_call_in_nested_expr() {
361361
let opt_foo = Some(Foo {
362362
val: String::from("123"),
363363
});
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() });
366366
}
367367

368368
fn main() {}

‎src/tools/clippy/tests/ui/or_fun_call.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ fn fn_call_in_nested_expr() {
361361
let opt_foo = Some(Foo {
362362
val: String::from("123"),
363363
});
364-
//~v ERROR: function call inside of `unwrap_or`
364+
// ok, `String::default()` is now `const`
365365
let _ = opt_foo.unwrap_or(Foo { val: String::default() });
366366
}
367367

‎src/tools/clippy/tests/ui/or_fun_call.stderr

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -238,11 +238,5 @@ error: use of `unwrap_or` to construct default value
238238
LL | let _ = opt.unwrap_or({ i32::default() });
239239
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
240240

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
248242

0 commit comments

Comments
 (0)