Skip to content

Commit 0aaea40

Browse files
committed
move some layout logic to rustc_target::abi::layout
1 parent ac6a77e commit 0aaea40

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

clippy_lints/src/casts/cast_possible_truncation.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@ use clippy_utils::consts::{constant, Constant};
22
use clippy_utils::diagnostics::span_lint;
33
use clippy_utils::expr_or_init;
44
use clippy_utils::ty::{get_discriminant_value, is_isize_or_usize};
5-
use rustc_ast::ast;
6-
use rustc_attr::IntType;
75
use rustc_hir::def::{DefKind, Res};
86
use rustc_hir::{BinOpKind, Expr, ExprKind};
97
use rustc_lint::LateContext;
108
use rustc_middle::ty::{self, FloatTy, Ty};
9+
use rustc_target::abi::IntegerType;
1110

1211
use super::{utils, CAST_ENUM_TRUNCATION, CAST_POSSIBLE_TRUNCATION};
1312

@@ -122,7 +121,7 @@ pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, cast_expr: &Expr<'_>,
122121
let cast_from_ptr_size = def.repr().int.map_or(true, |ty| {
123122
matches!(
124123
ty,
125-
IntType::SignedInt(ast::IntTy::Isize) | IntType::UnsignedInt(ast::UintTy::Usize)
124+
IntegerType::Pointer(_),
126125
)
127126
});
128127
let suffix = match (cast_from_ptr_size, is_isize_or_usize(cast_to)) {

clippy_lints/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
extern crate rustc_arena;
2727
extern crate rustc_ast;
2828
extern crate rustc_ast_pretty;
29-
extern crate rustc_attr;
3029
extern crate rustc_data_structures;
3130
extern crate rustc_driver;
3231
extern crate rustc_errors;

0 commit comments

Comments
 (0)