about summary refs log tree commit diff
path: root/clippy_lints/src/strings.rs
diff options
context:
space:
mode:
authorTimo <30553356+y21@users.noreply.github.com>2025-04-27 12:56:14 +0000
committerGitHub <noreply@github.com>2025-04-27 12:56:14 +0000
commit0dd9722cdc613c90ffc02f6bfb3185185c7ded3f (patch)
tree52e2b329e284151c58e0113717dec2b49e53de2d /clippy_lints/src/strings.rs
parent39a408664b383865a56a0a76bbef6e36654edf7d (diff)
parent7b337f6e259ce3ae19e1c0c22c8ff493ecb4a8a3 (diff)
downloadrust-0dd9722cdc613c90ffc02f6bfb3185185c7ded3f.tar.gz
rust-0dd9722cdc613c90ffc02f6bfb3185185c7ded3f.zip
Replace some `Symbol::as_str` usage (#14679)
Follow up to https://github.com/rust-lang/rust-clippy/pull/14650

Replaces uses in the form `s.as_str() == "literal"`

r? @y21

changelog: none
Diffstat (limited to 'clippy_lints/src/strings.rs')
-rw-r--r--clippy_lints/src/strings.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/clippy_lints/src/strings.rs b/clippy_lints/src/strings.rs
index 43a3e696105..af4d0d541f1 100644
--- a/clippy_lints/src/strings.rs
+++ b/clippy_lints/src/strings.rs
@@ -286,7 +286,7 @@ impl<'tcx> LateLintPass<'tcx> for StringLitAsBytes {
 
         if !e.span.in_external_macro(cx.sess().source_map())
             && let ExprKind::MethodCall(path, receiver, ..) = &e.kind
-            && path.ident.name.as_str() == "as_bytes"
+            && path.ident.name == sym::as_bytes
             && let ExprKind::Lit(lit) = &receiver.kind
             && let LitKind::Str(lit_content, _) = &lit.node
         {
@@ -332,7 +332,7 @@ impl<'tcx> LateLintPass<'tcx> for StringLitAsBytes {
         }
 
         if let ExprKind::MethodCall(path, recv, [], _) = &e.kind
-            && path.ident.name.as_str() == "into_bytes"
+            && path.ident.name == sym::into_bytes
             && let ExprKind::MethodCall(path, recv, [], _) = &recv.kind
             && matches!(path.ident.name.as_str(), "to_owned" | "to_string")
             && let ExprKind::Lit(lit) = &recv.kind
@@ -556,7 +556,7 @@ impl<'tcx> LateLintPass<'tcx> for TrimSplitWhitespace {
     fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &Expr<'_>) {
         let tyckres = cx.typeck_results();
         if let ExprKind::MethodCall(path, split_recv, [], split_ws_span) = expr.kind
-            && path.ident.name.as_str() == "split_whitespace"
+            && path.ident.name == sym::split_whitespace
             && let Some(split_ws_def_id) = tyckres.type_dependent_def_id(expr.hir_id)
             && cx.tcx.is_diagnostic_item(sym::str_split_whitespace, split_ws_def_id)
             && let ExprKind::MethodCall(path, _trim_recv, [], trim_span) = split_recv.kind