Skip to content

Commit

Permalink
Use is_diagnostic_item instead of get_diagnostic_item.
Browse files Browse the repository at this point in the history
  • Loading branch information
m-ou-se committed Aug 13, 2021
1 parent 5ad4106 commit 8fedb31
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions compiler/rustc_lint/src/non_fmt_panic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,10 @@ fn check_panic<'tcx>(cx: &LateContext<'tcx>, f: &'tcx hir::Expr<'tcx>, arg: &'tc
// If this is a &str or String, we can confidently give the `"{}", ` suggestion.
let is_str = matches!(
ty.kind(),
ty::Ref(_, r, _) if *r.kind() == ty::Str
ty::Ref(_, r, _) if *r.kind() == ty::Str,
) || matches!(
(ty.ty_adt_def(), cx.tcx.get_diagnostic_item(sym::string_type)),
(Some(ty_def), Some(string_type)) if ty_def.did == string_type
ty.ty_adt_def(),
Some(ty_def) if cx.tcx.is_diagnostic_item(sym::string_type, ty_def.did),
);
l.span_suggestion_verbose(
arg_span.shrink_to_lo(),
Expand Down

0 comments on commit 8fedb31

Please sign in to comment.