about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-02-14 21:07:04 +0000
committerbors <bors@rust-lang.org>2023-02-14 21:07:04 +0000
commit5a8b28871256fe650ef269eacf771ef26fc3ae00 (patch)
tree1db22d6f6c3c42c467e950a180cc55850b33247f
parente3a739a115f897379f844926ba8f8cfd880641de (diff)
parentb8c36429e4022f6e4e15949b264c85b126007023 (diff)
downloadrust-5a8b28871256fe650ef269eacf771ef26fc3ae00.tar.gz
rust-5a8b28871256fe650ef269eacf771ef26fc3ae00.zip
Auto merge of #108056 - matthiaskrgr:rollup-oa6bxvh, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #107573 (Update the minimum external LLVM to 14)
 - #107626 (Fix `x fix` on the standard library itself)
 - #107673 (update ICU4X to 1.1.0)
 - #107733 (Store metrics from `metrics.json` to CI PGO timer)
 - #108007 (Use `is_str` instead of string kind comparison)
 - #108033 (add an unstable `#[rustc_coinductive]` attribute)
 - #108039 (Refactor refcounted structural_impls via functors)
 - #108040 (Use derive attributes for uninteresting traversals)
 - #108044 (interpret: rename Pointer::from_addr → from_addr_invalid)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
-rw-r--r--clippy_lints/src/methods/expect_fun_call.rs4
-rw-r--r--clippy_lints/src/methods/search_is_some.rs3
-rw-r--r--clippy_lints/src/methods/single_char_pattern.rs2
-rw-r--r--clippy_lints/src/methods/string_extend_chars.rs3
-rw-r--r--clippy_lints/src/strings.rs4
-rw-r--r--clippy_lints/src/transmute/transmute_ref_to_ref.rs3
-rw-r--r--clippy_utils/src/ty.rs2
7 files changed, 10 insertions, 11 deletions
diff --git a/clippy_lints/src/methods/expect_fun_call.rs b/clippy_lints/src/methods/expect_fun_call.rs
index aed0ad5d9b5..a22285058d4 100644
--- a/clippy_lints/src/methods/expect_fun_call.rs
+++ b/clippy_lints/src/methods/expect_fun_call.rs
@@ -33,7 +33,7 @@ pub(super) fn check<'tcx>(
                     if (method_name.ident.name == sym::as_str || method_name.ident.name == sym::as_ref) && {
                         let arg_type = cx.typeck_results().expr_ty(receiver);
                         let base_type = arg_type.peel_refs();
-                        *base_type.kind() == ty::Str || is_type_lang_item(cx, base_type, hir::LangItem::String)
+                        base_type.is_str() || is_type_lang_item(cx, base_type, hir::LangItem::String)
                     } {
                         receiver
                     } else {
@@ -54,7 +54,7 @@ pub(super) fn check<'tcx>(
             return false;
         }
         if let ty::Ref(_, ty, ..) = arg_ty.kind() {
-            if *ty.kind() == ty::Str && can_be_static_str(cx, arg) {
+            if ty.is_str() && can_be_static_str(cx, arg) {
                 return false;
             }
         };
diff --git a/clippy_lints/src/methods/search_is_some.rs b/clippy_lints/src/methods/search_is_some.rs
index 1c031ad6acb..afdb8ce94ac 100644
--- a/clippy_lints/src/methods/search_is_some.rs
+++ b/clippy_lints/src/methods/search_is_some.rs
@@ -8,7 +8,6 @@ use rustc_errors::Applicability;
 use rustc_hir as hir;
 use rustc_hir::PatKind;
 use rustc_lint::LateContext;
-use rustc_middle::ty;
 use rustc_span::source_map::Span;
 use rustc_span::symbol::sym;
 
@@ -108,7 +107,7 @@ pub(super) fn check<'tcx>(
             if is_type_lang_item(cx, self_ty, hir::LangItem::String) {
                 true
             } else {
-                *self_ty.kind() == ty::Str
+                self_ty.is_str()
             }
         };
         if_chain! {
diff --git a/clippy_lints/src/methods/single_char_pattern.rs b/clippy_lints/src/methods/single_char_pattern.rs
index 4221c52d5cd..4d704ec39eb 100644
--- a/clippy_lints/src/methods/single_char_pattern.rs
+++ b/clippy_lints/src/methods/single_char_pattern.rs
@@ -47,7 +47,7 @@ pub(super) fn check(
     for &(method, pos) in &PATTERN_METHODS {
         if_chain! {
             if let ty::Ref(_, ty, _) = cx.typeck_results().expr_ty_adjusted(receiver).kind();
-            if *ty.kind() == ty::Str;
+            if ty.is_str();
             if method_name.as_str() == method && args.len() > pos;
             let arg = &args[pos];
             let mut applicability = Applicability::MachineApplicable;
diff --git a/clippy_lints/src/methods/string_extend_chars.rs b/clippy_lints/src/methods/string_extend_chars.rs
index f35d81cee8e..2c20c6d752d 100644
--- a/clippy_lints/src/methods/string_extend_chars.rs
+++ b/clippy_lints/src/methods/string_extend_chars.rs
@@ -5,7 +5,6 @@ use clippy_utils::ty::is_type_lang_item;
 use rustc_errors::Applicability;
 use rustc_hir as hir;
 use rustc_lint::LateContext;
-use rustc_middle::ty;
 
 use super::STRING_EXTEND_CHARS;
 
@@ -17,7 +16,7 @@ pub(super) fn check(cx: &LateContext<'_>, expr: &hir::Expr<'_>, recv: &hir::Expr
     if let Some(arglists) = method_chain_args(arg, &["chars"]) {
         let target = &arglists[0].0;
         let self_ty = cx.typeck_results().expr_ty(target).peel_refs();
-        let ref_str = if *self_ty.kind() == ty::Str {
+        let ref_str = if self_ty.is_str() {
             if matches!(target.kind, hir::ExprKind::Index(..)) {
                 "&"
             } else {
diff --git a/clippy_lints/src/strings.rs b/clippy_lints/src/strings.rs
index bc18cad6d38..b2f4b310915 100644
--- a/clippy_lints/src/strings.rs
+++ b/clippy_lints/src/strings.rs
@@ -190,7 +190,7 @@ impl<'tcx> LateLintPass<'tcx> for StringAdd {
             },
             ExprKind::Index(target, _idx) => {
                 let e_ty = cx.typeck_results().expr_ty(target).peel_refs();
-                if matches!(e_ty.kind(), ty::Str) || is_type_lang_item(cx, e_ty, LangItem::String) {
+                if e_ty.is_str() || is_type_lang_item(cx, e_ty, LangItem::String) {
                     span_lint(
                         cx,
                         STRING_SLICE,
@@ -407,7 +407,7 @@ impl<'tcx> LateLintPass<'tcx> for StrToString {
             if path.ident.name == sym::to_string;
             let ty = cx.typeck_results().expr_ty(self_arg);
             if let ty::Ref(_, ty, ..) = ty.kind();
-            if *ty.kind() == ty::Str;
+            if ty.is_str();
             then {
                 span_lint_and_help(
                     cx,
diff --git a/clippy_lints/src/transmute/transmute_ref_to_ref.rs b/clippy_lints/src/transmute/transmute_ref_to_ref.rs
index afb7f2e1326..426c7253806 100644
--- a/clippy_lints/src/transmute/transmute_ref_to_ref.rs
+++ b/clippy_lints/src/transmute/transmute_ref_to_ref.rs
@@ -22,7 +22,8 @@ pub(super) fn check<'tcx>(
 
     if let (ty::Ref(_, ty_from, from_mutbl), ty::Ref(_, ty_to, to_mutbl)) = (&from_ty.kind(), &to_ty.kind()) {
         if_chain! {
-            if let (&ty::Slice(slice_ty), &ty::Str) = (&ty_from.kind(), &ty_to.kind());
+            if let ty::Slice(slice_ty) = *ty_from.kind();
+            if ty_to.is_str();
             if let ty::Uint(ty::UintTy::U8) = slice_ty.kind();
             if from_mutbl == to_mutbl;
             then {
diff --git a/clippy_utils/src/ty.rs b/clippy_utils/src/ty.rs
index 0d763a2c5cf..d6af7a948a5 100644
--- a/clippy_utils/src/ty.rs
+++ b/clippy_utils/src/ty.rs
@@ -346,7 +346,7 @@ pub fn is_non_aggregate_primitive_type(ty: Ty<'_>) -> bool {
 pub fn is_recursively_primitive_type(ty: Ty<'_>) -> bool {
     match *ty.kind() {
         ty::Bool | ty::Char | ty::Int(_) | ty::Uint(_) | ty::Float(_) | ty::Str => true,
-        ty::Ref(_, inner, _) if *inner.kind() == ty::Str => true,
+        ty::Ref(_, inner, _) if inner.is_str() => true,
         ty::Array(inner_type, _) | ty::Slice(inner_type) => is_recursively_primitive_type(inner_type),
         ty::Tuple(inner_types) => inner_types.iter().all(is_recursively_primitive_type),
         _ => false,