1
Fork 0

Stop passing the self-type as a separate argument.

This commit is contained in:
Oli Scherer 2022-11-21 12:24:53 +00:00
parent a4da3f8863
commit 7658e0fccf
38 changed files with 113 additions and 164 deletions

View file

@ -152,13 +152,17 @@ 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, ty::List::empty(), cx.param_env).may_apply()
}) == Some(true);
|| cx
.tcx
.get_diagnostic_item(sym::Display)
.map(|t| infcx.type_implements_trait(t, [ty], cx.param_env).may_apply())
== Some(true);
let suggest_debug = !suggest_display
&& cx.tcx.get_diagnostic_item(sym::Debug).map(|t| {
infcx.type_implements_trait(t, ty, ty::List::empty(), cx.param_env).may_apply()
}) == Some(true);
&& cx
.tcx
.get_diagnostic_item(sym::Debug)
.map(|t| infcx.type_implements_trait(t, [ty], cx.param_env).may_apply())
== Some(true);
let suggest_panic_any = !is_str && panic == sym::std_panic_macro;