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! {
) -> 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) {
// 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>(