about summary refs log tree commit diff
path: root/clippy_lints/src/slow_vector_initialization.rs
diff options
context:
space:
mode:
authorJason Newcomb <jsnewcomb@pm.me>2021-11-11 14:15:01 -0500
committerJason Newcomb <jsnewcomb@pm.me>2022-10-02 15:02:55 -0400
commit162aa19793f21c99cf7ec2a8c080ee2f8843f7db (patch)
tree996b5d40be199472d950c4fc9431bcedcba2bffd /clippy_lints/src/slow_vector_initialization.rs
parent8e7af6b42961d6a4b6857c06aa5139a985e0009d (diff)
downloadrust-162aa19793f21c99cf7ec2a8c080ee2f8843f7db.tar.gz
rust-162aa19793f21c99cf7ec2a8c080ee2f8843f7db.zip
Fix and improve internal lint checking for `match_type` usages
* Check for `const`s and `static`s from external crates
* Check for `LangItem`s
* Handle inherent functions which have the same name as a field
* Also check the following functions:
    * `match_trait_method`
    * `match_def_path`
    * `is_expr_path_def_path`
    * `is_qpath_def_path`
* Handle checking for a constructor to a diagnostic item or `LangItem`
Diffstat (limited to 'clippy_lints/src/slow_vector_initialization.rs')
-rw-r--r--clippy_lints/src/slow_vector_initialization.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/clippy_lints/src/slow_vector_initialization.rs b/clippy_lints/src/slow_vector_initialization.rs
index 6e5d88e1b59..76039923151 100644
--- a/clippy_lints/src/slow_vector_initialization.rs
+++ b/clippy_lints/src/slow_vector_initialization.rs
@@ -2,7 +2,7 @@ use clippy_utils::diagnostics::span_lint_and_then;
 use clippy_utils::sugg::Sugg;
 use clippy_utils::ty::is_type_diagnostic_item;
 use clippy_utils::{
-    get_enclosing_block, is_expr_path_def_path, is_integer_literal, path_to_local, path_to_local_id, paths, SpanlessEq,
+    get_enclosing_block, is_integer_literal, is_path_diagnostic_item, path_to_local, path_to_local_id, SpanlessEq,
 };
 use if_chain::if_chain;
 use rustc_errors::Applicability;
@@ -254,7 +254,7 @@ impl<'a, 'tcx> VectorInitializationVisitor<'a, 'tcx> {
     fn is_repeat_zero(&self, expr: &Expr<'_>) -> bool {
         if_chain! {
             if let ExprKind::Call(fn_expr, [repeat_arg]) = expr.kind;
-            if is_expr_path_def_path(self.cx, fn_expr, &paths::ITER_REPEAT);
+            if is_path_diagnostic_item(self.cx, fn_expr, sym::iter_repeat);
             if is_integer_literal(repeat_arg, 0);
             then {
                 true