utilize cx.tcx.types.usize
This commit is contained in:
parent
a7c1ea96c4
commit
a48a6ef10f
1 changed files with 1 additions and 2 deletions
|
@ -1,5 +1,4 @@
|
||||||
use rustc::{declare_lint, hir, lint, lint_array, ty};
|
use rustc::{declare_lint, hir, lint, lint_array, ty};
|
||||||
use syntax::ast;
|
|
||||||
use crate::utils;
|
use crate::utils;
|
||||||
|
|
||||||
/// **What it does:** Checks for usage of the `offset` pointer method with a `usize` casted to an
|
/// **What it does:** Checks for usage of the `offset` pointer method with a `usize` casted to an
|
||||||
|
@ -100,7 +99,7 @@ fn is_expr_ty_usize<'a, 'tcx>(
|
||||||
cx: &lint::LateContext<'a, 'tcx>,
|
cx: &lint::LateContext<'a, 'tcx>,
|
||||||
expr: &hir::Expr,
|
expr: &hir::Expr,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
cx.tables.expr_ty(expr).sty == ty::TyKind::Uint(ast::UintTy::Usize)
|
cx.tables.expr_ty(expr) == cx.tcx.types.usize
|
||||||
}
|
}
|
||||||
|
|
||||||
// Is the type of the expression a raw pointer?
|
// Is the type of the expression a raw pointer?
|
||||||
|
|
Loading…
Add table
Reference in a new issue