Skip to content

Commit dbd6681

Browse files
committed
test: fix test errors
1 parent 3cc6bbb commit dbd6681

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

clippy_lints/src/lines_filter_map_ok.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,7 @@ fn should_lint(cx: &LateContext<'_>, args: &[Expr<'_>], method_str: &str) -> boo
9696
ExprKind::Path(qpath) => cx
9797
.qpath_res(qpath, fm_arg.hir_id)
9898
.opt_def_id()
99-
.map(|did| match_def_path(cx, did, &paths::CORE_RESULT_OK_METHOD))
100-
.unwrap_or_default(),
99+
.is_some_and(|did| match_def_path(cx, did, &paths::CORE_RESULT_OK_METHOD)),
101100
// Detect `|x| x.ok()`
102101
ExprKind::Closure(Closure { body, .. }) => {
103102
if let Body {

clippy_lints/src/methods/map_unwrap_or_default.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use clippy_utils::diagnostics::span_lint_and_then;
33
use clippy_utils::ty::{expr_sig, is_type_diagnostic_item};
44
use rustc_errors::Applicability;
55
use rustc_lint::LateContext;
6+
use rustc_middle::ty::Ty;
67
use rustc_span::{sym, Span};
78

89
use super::MAP_UNWRAP_OR_DEFAULT;
@@ -33,7 +34,7 @@ pub(super) fn check<'tcx>(
3334
let map_arg_return_bool = expr_sig(cx, map_arg).is_some_and(|fn_sig| {
3435
fn_sig
3536
.output()
36-
.is_some_and(|ret| ret.no_bound_vars().is_some_and(|ty| ty.is_bool()))
37+
.is_some_and(|ret| ret.no_bound_vars().is_some_and(Ty::is_bool))
3738
});
3839
if !map_arg_return_bool {
3940
return;
@@ -62,7 +63,7 @@ pub(super) fn check<'tcx>(
6263
(expr.span.with_lo(unwrap_recv.span.hi()), String::new()),
6364
];
6465
diag.multipart_suggestion(
65-
format!("use {} instead", suggest),
66+
format!("use {suggest} instead"),
6667
suggestion,
6768
Applicability::MachineApplicable,
6869
);

clippy_lints/src/methods/mod.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4565,11 +4565,8 @@ impl Methods {
45654565
unnecessary_literal_unwrap::check(cx, expr, recv, name, args);
45664566
},
45674567
("unwrap_or_default", []) => {
4568-
match method_call(recv) {
4569-
Some(("map", m_recv, [arg], span, _)) => {
4570-
map_unwrap_or_default::check(cx, expr, m_recv, arg, span, recv, &self.msrv);
4571-
},
4572-
_ => {},
4568+
if let Some(("map", m_recv, [arg], span, _)) = method_call(recv) {
4569+
map_unwrap_or_default::check(cx, expr, m_recv, arg, span, recv, &self.msrv);
45734570
}
45744571
unnecessary_literal_unwrap::check(cx, expr, recv, name, args);
45754572
},

0 commit comments

Comments
 (0)