Skip to content

Commit 8fedb31

Browse files
committed
Use is_diagnostic_item instead of get_diagnostic_item.
1 parent 5ad4106 commit 8fedb31

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

compiler/rustc_lint/src/non_fmt_panic.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,10 @@ fn check_panic<'tcx>(cx: &LateContext<'tcx>, f: &'tcx hir::Expr<'tcx>, arg: &'tc
124124
// If this is a &str or String, we can confidently give the `"{}", ` suggestion.
125125
let is_str = matches!(
126126
ty.kind(),
127-
ty::Ref(_, r, _) if *r.kind() == ty::Str
127+
ty::Ref(_, r, _) if *r.kind() == ty::Str,
128128
) || matches!(
129-
(ty.ty_adt_def(), cx.tcx.get_diagnostic_item(sym::string_type)),
130-
(Some(ty_def), Some(string_type)) if ty_def.did == string_type
129+
ty.ty_adt_def(),
130+
Some(ty_def) if cx.tcx.is_diagnostic_item(sym::string_type, ty_def.did),
131131
);
132132
l.span_suggestion_verbose(
133133
arg_span.shrink_to_lo(),

0 commit comments

Comments
 (0)