From 2a5a2fae2c253903074e8a55f9be9c8eb5a29136 Mon Sep 17 00:00:00 2001 From: Samuel Tardieu Date: Tue, 3 Jun 2025 19:44:09 +0200 Subject: Use interned strings when possible, for efficiency purposes Also, a number of unnecessary `.as_str()` calls have been removed for clarity. --- clippy_lints/src/vec_init_then_push.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'clippy_lints/src/vec_init_then_push.rs') 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), -- cgit 1.4.1-3-g733a5