summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_lint/src/non_fmt_panic.rs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_lint/src/non_fmt_panic.rs')
-rw-r--r--compiler/rustc_lint/src/non_fmt_panic.rs19
1 files changed, 7 insertions, 12 deletions
diff --git a/compiler/rustc_lint/src/non_fmt_panic.rs b/compiler/rustc_lint/src/non_fmt_panic.rs
index b218cc578..9fcd70ba0 100644
--- a/compiler/rustc_lint/src/non_fmt_panic.rs
+++ b/compiler/rustc_lint/src/non_fmt_panic.rs
@@ -126,7 +126,7 @@ fn check_panic<'tcx>(cx: &LateContext<'tcx>, f: &'tcx hir::Expr<'tcx>, arg: &'tc
lint.note(fluent::lint_more_info_note);
if !is_arg_inside_call(arg_span, span) {
// No clue where this argument is coming from.
- return lint;
+ return;
}
if arg_macro.is_some_and(|id| cx.tcx.is_diagnostic_item(sym::format_macro, id)) {
// A case of `panic!(format!(..))`.
@@ -154,17 +154,13 @@ fn check_panic<'tcx>(cx: &LateContext<'tcx>, f: &'tcx hir::Expr<'tcx>, arg: &'tc
let infcx = cx.tcx.infer_ctxt().build();
let suggest_display = is_str
- || cx
- .tcx
- .get_diagnostic_item(sym::Display)
- .map(|t| infcx.type_implements_trait(t, [ty], cx.param_env).may_apply())
- == Some(true);
+ || cx.tcx.get_diagnostic_item(sym::Display).is_some_and(|t| {
+ infcx.type_implements_trait(t, [ty], cx.param_env).may_apply()
+ });
let suggest_debug = !suggest_display
- && cx
- .tcx
- .get_diagnostic_item(sym::Debug)
- .map(|t| infcx.type_implements_trait(t, [ty], cx.param_env).may_apply())
- == Some(true);
+ && cx.tcx.get_diagnostic_item(sym::Debug).is_some_and(|t| {
+ infcx.type_implements_trait(t, [ty], cx.param_env).may_apply()
+ });
let suggest_panic_any = !is_str && panic == sym::std_panic_macro;
@@ -211,7 +207,6 @@ fn check_panic<'tcx>(cx: &LateContext<'tcx>, f: &'tcx hir::Expr<'tcx>, arg: &'tc
}
}
}
- lint
});
}