Skip to content

Commit 646192a

Browse files
committed
Improve uwrap or default
1 parent 9ae4043 commit 646192a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

clippy_lints/src/methods/unwrap_or_else_default.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
use super::UNWRAP_OR_ELSE_DEFAULT;
44
use clippy_utils::{
5-
diagnostics::span_lint_and_sugg, is_trait_item, source::snippet_with_applicability, ty::is_type_diagnostic_item,
5+
diagnostics::span_lint_and_sugg, is_trait_item, is_default_equivalent, source::snippet_with_applicability, ty::is_type_diagnostic_item,
66
};
77
use rustc_errors::Applicability;
88
use rustc_hir as hir;
@@ -24,7 +24,7 @@ pub(super) fn check<'tcx>(
2424

2525
if_chain! {
2626
if is_option || is_result;
27-
if is_trait_item(cx, u_arg, sym::Default);
27+
if is_trait_item(cx, u_arg, sym::Default) || is_default_equivalent(cx, u_arg);
2828
then {
2929
let mut applicability = Applicability::MachineApplicable;
3030

0 commit comments

Comments
 (0)