]> git.lizzy.rs Git - rust.git/blobdiff - clippy_lints/src/ptr_offset_with_cast.rs
ast/hir: Rename field-related structures
[rust.git] / clippy_lints / src / ptr_offset_with_cast.rs
index 61e186a4b4653f59c6218c3ad05e4f275b9a567f..e0996804a5934a8ad77c83a30fc363c3452c7e82 100644 (file)
@@ -3,6 +3,7 @@
 use rustc_hir::{Expr, ExprKind};
 use rustc_lint::{LateContext, LateLintPass};
 use rustc_session::{declare_lint_pass, declare_tool_lint};
+use rustc_span::sym;
 use std::fmt;
 
 declare_clippy_lint! {
@@ -92,7 +93,7 @@ fn expr_as_ptr_offset_call<'tcx>(
 ) -> Option<(&'tcx Expr<'tcx>, &'tcx Expr<'tcx>, Method)> {
     if let ExprKind::MethodCall(ref path_segment, _, ref args, _) = expr.kind {
         if is_expr_ty_raw_ptr(cx, &args[0]) {
-            if path_segment.ident.name == sym!(offset) {
+            if path_segment.ident.name == sym::offset {
                 return Some((&args[0], &args[1], Method::Offset));
             }
             if path_segment.ident.name == sym!(wrapping_offset) {
@@ -105,12 +106,12 @@ fn expr_as_ptr_offset_call<'tcx>(
 
 // Is the type of the expression a usize?
 fn is_expr_ty_usize<'tcx>(cx: &LateContext<'tcx>, expr: &Expr<'_>) -> bool {
-    cx.tables().expr_ty(expr) == cx.tcx.types.usize
+    cx.typeck_results().expr_ty(expr) == cx.tcx.types.usize
 }
 
 // Is the type of the expression a raw pointer?
 fn is_expr_ty_raw_ptr<'tcx>(cx: &LateContext<'tcx>, expr: &Expr<'_>) -> bool {
-    cx.tables().expr_ty(expr).is_unsafe_ptr()
+    cx.typeck_results().expr_ty(expr).is_unsafe_ptr()
 }
 
 fn build_suggestion<'tcx>(