diff options
| author | hkalbasi <hamidrezakalbasi@protonmail.com> | 2022-11-01 19:50:30 +0330 |
|---|---|---|
| committer | hkalbasi <hamidrezakalbasi@protonmail.com> | 2022-11-24 16:26:12 +0330 |
| commit | 0aaea40eb2015a109d0be49c0d08f6435c6ce437 (patch) | |
| tree | ed78d8c690954a9bf48b10d5fcaaf81d1435dd90 /clippy_lints/src/casts | |
| parent | ac6a77ed951b63aad0133469fb8914d121e156ce (diff) | |
| download | rust-0aaea40eb2015a109d0be49c0d08f6435c6ce437.tar.gz rust-0aaea40eb2015a109d0be49c0d08f6435c6ce437.zip | |
move some layout logic to rustc_target::abi::layout
Diffstat (limited to 'clippy_lints/src/casts')
| -rw-r--r-- | clippy_lints/src/casts/cast_possible_truncation.rs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/clippy_lints/src/casts/cast_possible_truncation.rs b/clippy_lints/src/casts/cast_possible_truncation.rs index 88deb4565eb..adbcfd3189b 100644 --- a/clippy_lints/src/casts/cast_possible_truncation.rs +++ b/clippy_lints/src/casts/cast_possible_truncation.rs @@ -2,12 +2,11 @@ use clippy_utils::consts::{constant, Constant}; use clippy_utils::diagnostics::span_lint; use clippy_utils::expr_or_init; use clippy_utils::ty::{get_discriminant_value, is_isize_or_usize}; -use rustc_ast::ast; -use rustc_attr::IntType; use rustc_hir::def::{DefKind, Res}; use rustc_hir::{BinOpKind, Expr, ExprKind}; use rustc_lint::LateContext; use rustc_middle::ty::{self, FloatTy, Ty}; +use rustc_target::abi::IntegerType; use super::{utils, CAST_ENUM_TRUNCATION, CAST_POSSIBLE_TRUNCATION}; @@ -122,7 +121,7 @@ pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, cast_expr: &Expr<'_>, let cast_from_ptr_size = def.repr().int.map_or(true, |ty| { matches!( ty, - IntType::SignedInt(ast::IntTy::Isize) | IntType::UnsignedInt(ast::UintTy::Usize) + IntegerType::Pointer(_), ) }); let suffix = match (cast_from_ptr_size, is_isize_or_usize(cast_to)) { |
