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/casts/cast_ptr_alignment.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'clippy_lints/src/casts') diff --git a/clippy_lints/src/casts/cast_ptr_alignment.rs b/clippy_lints/src/casts/cast_ptr_alignment.rs index 01020f3eee2..e4dafde0f9d 100644 --- a/clippy_lints/src/casts/cast_ptr_alignment.rs +++ b/clippy_lints/src/casts/cast_ptr_alignment.rs @@ -61,7 +61,7 @@ fn is_used_as_unaligned(cx: &LateContext<'_>, e: &Expr<'_>) -> bool { }; match parent.kind { ExprKind::MethodCall(name, self_arg, ..) if self_arg.hir_id == e.hir_id => { - if matches!(name.ident.as_str(), "read_unaligned" | "write_unaligned") + if matches!(name.ident.name, sym::read_unaligned | sym::write_unaligned) && let Some(def_id) = cx.typeck_results().type_dependent_def_id(parent.hir_id) && let Some(def_id) = cx.tcx.impl_of_method(def_id) && cx.tcx.type_of(def_id).instantiate_identity().is_raw_ptr() -- cgit 1.4.1-3-g733a5