about summary refs log tree commit diff
path: root/clippy_lints/src/len_zero.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/len_zero.rs
parent39a408664b383865a56a0a76bbef6e36654edf7d (diff)
parent7b337f6e259ce3ae19e1c0c22c8ff493ecb4a8a3 (diff)
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/len_zero.rs')
-rw-r--r--clippy_lints/src/len_zero.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/clippy_lints/src/len_zero.rs b/clippy_lints/src/len_zero.rs
index 8c71d34c95f..aded31971ce 100644
--- a/clippy_lints/src/len_zero.rs
+++ b/clippy_lints/src/len_zero.rs
@@ -2,7 +2,9 @@ use clippy_utils::diagnostics::{span_lint, span_lint_and_sugg, span_lint_and_the
 use clippy_utils::source::{SpanRangeExt, snippet_with_context};
 use clippy_utils::sugg::{Sugg, has_enclosing_paren};
 use clippy_utils::ty::implements_trait;
-use clippy_utils::{fulfill_or_allowed, get_item_name, get_parent_as_impl, is_trait_method, peel_ref_operators, sym};
+use clippy_utils::{
+    fulfill_or_allowed, get_parent_as_impl, is_trait_method, parent_item_name, peel_ref_operators, sym,
+};
 use rustc_ast::ast::LitKind;
 use rustc_errors::Applicability;
 use rustc_hir::def::Res;
@@ -533,9 +535,7 @@ fn check_cmp(cx: &LateContext<'_>, span: Span, method: &Expr<'_>, lit: &Expr<'_>
 
     if let (&ExprKind::MethodCall(method_path, receiver, [], _), ExprKind::Lit(lit)) = (&method.kind, &lit.kind) {
         // check if we are in an is_empty() method
-        if let Some(name) = get_item_name(cx, method)
-            && name.as_str() == "is_empty"
-        {
+        if parent_item_name(cx, method) == Some(sym::is_empty) {
             return;
         }