From e7dffeedcffce81f709da8a076b8ff437b8d3060 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Fri, 8 Nov 2024 10:42:07 +1100 Subject: [PATCH] Use an atom comparison for a keyword check. Instead of a string comparison. --- compiler/rustc_resolve/src/ident.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/compiler/rustc_resolve/src/ident.rs b/compiler/rustc_resolve/src/ident.rs index c8f7a12132cd2..d8e1e296b22a6 100644 --- a/compiler/rustc_resolve/src/ident.rs +++ b/compiler/rustc_resolve/src/ident.rs @@ -1199,7 +1199,9 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { // Still doesn't deal with upvars if let Some(span) = finalize { let (span, resolution_error) = match item { - None if rib_ident.as_str() == "self" => (span, LowercaseSelf), + None if rib_ident.name == kw::SelfLower => { + (span, LowercaseSelf) + } None => { // If we have a `let name = expr;`, we have the span for // `name` and use that to see if it is followed by a type