Skip to content

Commit c215d30

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

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
@@ -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

413413
mod result_map_or {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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

413413
mod result_map_or {

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

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -240,12 +240,6 @@ 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: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-
249243
error: 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`
264258
LL | 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

0 commit comments

Comments
 (0)