about summary refs log tree commit diff
path: root/clippy_lints/src/vec_init_then_push.rs
diff options
context:
space:
mode:
authorllogiq <bogusandre@gmail.com>2025-06-04 05:16:22 +0000
committerGitHub <noreply@github.com>2025-06-04 05:16:22 +0000
commit84ef7fb4144c7efbc541e47cb9fd11cd312674b3 (patch)
treea7a4112e9758027e3d6bfdfd88e96abc8d340453 /clippy_lints/src/vec_init_then_push.rs
parenta4debd23453c05ab0fc278ed4e544458bac1985f (diff)
parent2a5a2fae2c253903074e8a55f9be9c8eb5a29136 (diff)
Use interned strings when possible, for efficiency purposes (#14963)
Also, a number of unnecessary `.as_str()` calls have been removed for
clarity.

changelog: none
Diffstat (limited to 'clippy_lints/src/vec_init_then_push.rs')
-rw-r--r--clippy_lints/src/vec_init_then_push.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/clippy_lints/src/vec_init_then_push.rs b/clippy_lints/src/vec_init_then_push.rs
index 3c23662e9d1..8d873536295 100644
--- a/clippy_lints/src/vec_init_then_push.rs
+++ b/clippy_lints/src/vec_init_then_push.rs
@@ -2,7 +2,7 @@ use clippy_utils::diagnostics::span_lint_and_sugg;
 use clippy_utils::higher::{VecInitKind, get_vec_init_kind};
 use clippy_utils::source::snippet;
 use clippy_utils::visitors::for_each_local_use_after_expr;
-use clippy_utils::{get_parent_expr, path_to_local_id};
+use clippy_utils::{get_parent_expr, path_to_local_id, sym};
 use core::ops::ControlFlow;
 use rustc_errors::Applicability;
 use rustc_hir::def::Res;
@@ -202,7 +202,7 @@ impl<'tcx> LateLintPass<'tcx> for VecInitThenPush {
             if let StmtKind::Expr(expr) | StmtKind::Semi(expr) = stmt.kind
                 && let ExprKind::MethodCall(name, self_arg, [_], _) = expr.kind
                 && path_to_local_id(self_arg, searcher.local_id)
-                && name.ident.as_str() == "push"
+                && name.ident.name == sym::push
             {
                 self.searcher = Some(VecPushSearcher {
                     err_span: searcher.err_span.to(stmt.span),