@@ -41,16 +41,12 @@ use rustc_infer::infer::TyCtxtInferExt;
4141use rustc_lint:: { LateContext , Level , Lint , LintContext } ;
4242use rustc_middle:: hir:: map:: Map ;
4343use rustc_middle:: traits;
44- use rustc_middle:: ty:: {
45- self ,
46- layout:: { self , IntegerExt } ,
47- subst:: GenericArg ,
48- Binder , Ty , TyCtxt , TypeFoldable ,
49- } ;
44+ use rustc_middle:: ty:: { self , layout:: IntegerExt , subst:: GenericArg , Binder , Ty , TyCtxt , TypeFoldable } ;
5045use rustc_span:: hygiene:: { ExpnKind , MacroKind } ;
5146use rustc_span:: source_map:: original_sp;
5247use rustc_span:: symbol:: { self , kw, Symbol } ;
5348use rustc_span:: { BytePos , Pos , Span , DUMMY_SP } ;
49+ use rustc_target:: abi:: Integer ;
5450use rustc_trait_selection:: traits:: predicate_for_trait_def;
5551use rustc_trait_selection:: traits:: query:: evaluate_obligation:: InferCtxtExt ;
5652use rustc_trait_selection:: traits:: query:: normalize:: AtExt ;
@@ -1080,9 +1076,7 @@ pub fn get_arg_name(pat: &Pat<'_>) -> Option<ast::Name> {
10801076}
10811077
10821078pub fn int_bits ( tcx : TyCtxt < ' _ > , ity : ast:: IntTy ) -> u64 {
1083- layout:: Integer :: from_attr ( & tcx, attr:: IntType :: SignedInt ( ity) )
1084- . size ( )
1085- . bits ( )
1079+ Integer :: from_attr ( & tcx, attr:: IntType :: SignedInt ( ity) ) . size ( ) . bits ( )
10861080}
10871081
10881082#[ allow( clippy:: cast_possible_wrap) ]
@@ -1101,9 +1095,7 @@ pub fn unsext(tcx: TyCtxt<'_>, u: i128, ity: ast::IntTy) -> u128 {
11011095
11021096/// clip unused bytes
11031097pub fn clip ( tcx : TyCtxt < ' _ > , u : u128 , ity : ast:: UintTy ) -> u128 {
1104- let bits = layout:: Integer :: from_attr ( & tcx, attr:: IntType :: UnsignedInt ( ity) )
1105- . size ( )
1106- . bits ( ) ;
1098+ let bits = Integer :: from_attr ( & tcx, attr:: IntType :: UnsignedInt ( ity) ) . size ( ) . bits ( ) ;
11071099 let amt = 128 - bits;
11081100 ( u << amt) >> amt
11091101}
0 commit comments