Skip to content

Commit eaaabae

Browse files
committed
[double check] update clippy test
The lint should likely still trigger while the const Default impl is unstable.
1 parent 90bd3f9 commit eaaabae

File tree

4 files changed

+5
-10
lines changed

4 files changed

+5
-10
lines changed

‎src/tools/clippy/clippy_utils/src/hir_utils.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ type SpanlessEqCallback<'a> = dyn FnMut(&Expr<'_>, &Expr<'_>) -> bool + 'a;
2626

2727
/// Determines how paths are hashed and compared for equality.
2828
#[derive(Copy, Clone, Debug, Default)]
29+
#[allow(dead_code)]
2930
pub enum PathCheck {
3031
/// Paths must match exactly and are hashed by their exact HIR tree.
3132
///

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,8 +405,8 @@ fn fn_call_in_nested_expr() {
405405
val: String::from("123"),
406406
});
407407

408-
let _ = opt_foo.unwrap_or_else(|| Foo { val: String::default() });
409-
//~^ or_fun_call
408+
// ok, `String::default()` is now `const`
409+
let _ = opt_foo.unwrap_or(Foo { val: String::default() });
410410
}
411411

412412
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
@@ -405,8 +405,8 @@ fn fn_call_in_nested_expr() {
405405
val: String::from("123"),
406406
});
407407

408+
// ok, `String::default()` is now `const`
408409
let _ = opt_foo.unwrap_or(Foo { val: String::default() });
409-
//~^ or_fun_call
410410
}
411411

412412
fn main() {}

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

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -240,11 +240,5 @@ error: use of `unwrap_or` to construct default value
240240
LL | 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:408: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-
error: aborting due to 38 previous errors
243+
error: aborting due to 37 previous errors
250244

0 commit comments

Comments
 (0)