diff options
| author | Samuel Tardieu <sam@rfc1149.net> | 2025-05-18 16:05:12 +0200 |
|---|---|---|
| committer | Samuel Tardieu <sam@rfc1149.net> | 2025-05-19 22:47:57 +0200 |
| commit | e16801e68c8d3fef6edcbeabd60cd535754ec017 (patch) | |
| tree | f7281b74426fc9122b22a2acab75ad62f661bde5 /clippy_lints/src/index_refutable_slice.rs | |
| parent | 82bf659dc80a1ab4da1b473206131f4d70a41ea9 (diff) | |
| download | rust-e16801e68c8d3fef6edcbeabd60cd535754ec017.tar.gz rust-e16801e68c8d3fef6edcbeabd60cd535754ec017.zip | |
Use symbols instead of `&str` when possible
Diffstat (limited to 'clippy_lints/src/index_refutable_slice.rs')
| -rw-r--r-- | clippy_lints/src/index_refutable_slice.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/clippy_lints/src/index_refutable_slice.rs b/clippy_lints/src/index_refutable_slice.rs index 989997d69f7..0b1cae30ca5 100644 --- a/clippy_lints/src/index_refutable_slice.rs +++ b/clippy_lints/src/index_refutable_slice.rs @@ -4,7 +4,7 @@ use clippy_utils::diagnostics::span_lint_and_then; use clippy_utils::higher::IfLet; use clippy_utils::msrvs::{self, Msrv}; use clippy_utils::ty::is_copy; -use clippy_utils::{is_expn_of, is_lint_allowed, path_to_local}; +use clippy_utils::{is_expn_of, is_lint_allowed, path_to_local, sym}; use rustc_data_structures::fx::{FxHashSet, FxIndexMap, FxIndexSet}; use rustc_errors::Applicability; use rustc_hir as hir; @@ -72,7 +72,7 @@ impl_lint_pass!(IndexRefutableSlice => [INDEX_REFUTABLE_SLICE]); impl<'tcx> LateLintPass<'tcx> for IndexRefutableSlice { fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'_>) { if let Some(IfLet { let_pat, if_then, .. }) = IfLet::hir(cx, expr) - && (!expr.span.from_expansion() || is_expn_of(expr.span, "if_chain").is_some()) + && (!expr.span.from_expansion() || is_expn_of(expr.span, sym::if_chain).is_some()) && !is_lint_allowed(cx, INDEX_REFUTABLE_SLICE, expr.hir_id) && let found_slices = find_slice_values(cx, let_pat) && !found_slices.is_empty() |
