1
Fork 0

Rollup merge of #108007 - compiler-errors:str-less-kind, r=Nilstrieb

Use `is_str` instead of string kind comparison

Split out from #107939
This commit is contained in:
Matthias Krüger 2023-02-14 18:24:42 +01:00 committed by GitHub
commit 7e0127b2ae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 11 additions and 12 deletions

View file

@ -146,7 +146,7 @@ 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.is_str(),
) || matches!(
ty.ty_adt_def(),
Some(ty_def) if Some(ty_def.did()) == cx.tcx.lang_items().string(),