Use is_diagnostic_item instead of get_diagnostic_item.
This commit is contained in:
parent
5ad41069e6
commit
8fedb31649
1 changed files with 3 additions and 3 deletions
|
@ -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.
|
// If this is a &str or String, we can confidently give the `"{}", ` suggestion.
|
||||||
let is_str = matches!(
|
let is_str = matches!(
|
||||||
ty.kind(),
|
ty.kind(),
|
||||||
ty::Ref(_, r, _) if *r.kind() == ty::Str
|
ty::Ref(_, r, _) if *r.kind() == ty::Str,
|
||||||
) || matches!(
|
) || matches!(
|
||||||
(ty.ty_adt_def(), cx.tcx.get_diagnostic_item(sym::string_type)),
|
ty.ty_adt_def(),
|
||||||
(Some(ty_def), Some(string_type)) if ty_def.did == string_type
|
Some(ty_def) if cx.tcx.is_diagnostic_item(sym::string_type, ty_def.did),
|
||||||
);
|
);
|
||||||
l.span_suggestion_verbose(
|
l.span_suggestion_verbose(
|
||||||
arg_span.shrink_to_lo(),
|
arg_span.shrink_to_lo(),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue