]> git.lizzy.rs Git - rust.git/blobdiff - clippy_lints/src/swap.rs
ast/hir: Rename field-related structures
[rust.git] / clippy_lints / src / swap.rs
index 54b38d9f4ced2142e3201034c82fce78d54ed9f5..9d8a0c248334f582af850002b48f112be4447374 100644 (file)
@@ -8,6 +8,7 @@
 use rustc_lint::{LateContext, LateLintPass};
 use rustc_middle::ty;
 use rustc_session::{declare_lint_pass, declare_tool_lint};
+use rustc_span::sym;
 
 declare_clippy_lint! {
     /// **What it does:** Checks for manual swapping.
@@ -90,7 +91,7 @@ fn check_manual_swap(cx: &LateContext<'_>, block: &Block<'_>) {
             if let ExprKind::Path(QPath::Resolved(None, ref rhs2)) = rhs2.kind;
             if rhs2.segments.len() == 1;
 
-            if ident.as_str() == rhs2.segments[0].ident.as_str();
+            if ident.name == rhs2.segments[0].ident.name;
             if eq_expr_value(cx, tmp_init, lhs1);
             if eq_expr_value(cx, rhs1, lhs2);
             then {
@@ -197,8 +198,8 @@ fn check_for_slice<'a>(cx: &LateContext<'_>, lhs1: &'a Expr<'_>, lhs2: &'a Expr<
 
                 if matches!(ty.kind(), ty::Slice(_))
                     || matches!(ty.kind(), ty::Array(_, _))
-                    || is_type_diagnostic_item(cx, ty, sym!(vec_type))
-                    || is_type_diagnostic_item(cx, ty, sym!(vecdeque_type))
+                    || is_type_diagnostic_item(cx, ty, sym::vec_type)
+                    || is_type_diagnostic_item(cx, ty, sym::vecdeque_type)
                 {
                     return Slice::Swappable(lhs1, idx1, idx2);
                 }