@@ -1945,16 +1945,12 @@ fn detect_extreme_expr<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr<'_
19451945
19461946 let which = match ( & ty. kind , cv) {
19471947 ( & ty:: Bool , Constant :: Bool ( false ) ) | ( & ty:: Uint ( _) , Constant :: Int ( 0 ) ) => Minimum ,
1948- ( & ty:: Int ( ity) , Constant :: Int ( i) )
1949- if i == unsext ( cx. tcx , i128:: MIN >> ( 128 - int_bits ( cx. tcx , ity) ) , ity) =>
1950- {
1948+ ( & ty:: Int ( ity) , Constant :: Int ( i) ) if i == unsext ( cx. tcx , i128:: MIN >> ( 128 - int_bits ( cx. tcx , ity) ) , ity) => {
19511949 Minimum
19521950 } ,
19531951
19541952 ( & ty:: Bool , Constant :: Bool ( true ) ) => Maximum ,
1955- ( & ty:: Int ( ity) , Constant :: Int ( i) )
1956- if i == unsext ( cx. tcx , i128:: MAX >> ( 128 - int_bits ( cx. tcx , ity) ) , ity) =>
1957- {
1953+ ( & ty:: Int ( ity) , Constant :: Int ( i) ) if i == unsext ( cx. tcx , i128:: MAX >> ( 128 - int_bits ( cx. tcx , ity) ) , ity) => {
19581954 Maximum
19591955 } ,
19601956 ( & ty:: Uint ( uty) , Constant :: Int ( i) ) if clip ( cx. tcx , u128:: MAX , uty) == i => Maximum ,
@@ -2083,50 +2079,20 @@ fn numeric_cast_precast_bounds<'a>(cx: &LateContext<'_, '_>, expr: &'a Expr<'_>)
20832079 }
20842080 match pre_cast_ty. kind {
20852081 ty:: Int ( int_ty) => Some ( match int_ty {
2086- IntTy :: I8 => (
2087- FullInt :: S ( i128:: from ( i8:: MIN ) ) ,
2088- FullInt :: S ( i128:: from ( i8:: MAX ) ) ,
2089- ) ,
2090- IntTy :: I16 => (
2091- FullInt :: S ( i128:: from ( i16:: MIN ) ) ,
2092- FullInt :: S ( i128:: from ( i16:: MAX ) ) ,
2093- ) ,
2094- IntTy :: I32 => (
2095- FullInt :: S ( i128:: from ( i32:: MIN ) ) ,
2096- FullInt :: S ( i128:: from ( i32:: MAX ) ) ,
2097- ) ,
2098- IntTy :: I64 => (
2099- FullInt :: S ( i128:: from ( i64:: MIN ) ) ,
2100- FullInt :: S ( i128:: from ( i64:: MAX ) ) ,
2101- ) ,
2082+ IntTy :: I8 => ( FullInt :: S ( i128:: from ( i8:: MIN ) ) , FullInt :: S ( i128:: from ( i8:: MAX ) ) ) ,
2083+ IntTy :: I16 => ( FullInt :: S ( i128:: from ( i16:: MIN ) ) , FullInt :: S ( i128:: from ( i16:: MAX ) ) ) ,
2084+ IntTy :: I32 => ( FullInt :: S ( i128:: from ( i32:: MIN ) ) , FullInt :: S ( i128:: from ( i32:: MAX ) ) ) ,
2085+ IntTy :: I64 => ( FullInt :: S ( i128:: from ( i64:: MIN ) ) , FullInt :: S ( i128:: from ( i64:: MAX ) ) ) ,
21022086 IntTy :: I128 => ( FullInt :: S ( i128:: MIN ) , FullInt :: S ( i128:: MAX ) ) ,
2103- IntTy :: Isize => (
2104- FullInt :: S ( isize:: MIN as i128 ) ,
2105- FullInt :: S ( isize:: MAX as i128 ) ,
2106- ) ,
2087+ IntTy :: Isize => ( FullInt :: S ( isize:: MIN as i128 ) , FullInt :: S ( isize:: MAX as i128 ) ) ,
21072088 } ) ,
21082089 ty:: Uint ( uint_ty) => Some ( match uint_ty {
2109- UintTy :: U8 => (
2110- FullInt :: U ( u128:: from ( u8:: MIN ) ) ,
2111- FullInt :: U ( u128:: from ( u8:: MAX ) ) ,
2112- ) ,
2113- UintTy :: U16 => (
2114- FullInt :: U ( u128:: from ( u16:: MIN ) ) ,
2115- FullInt :: U ( u128:: from ( u16:: MAX ) ) ,
2116- ) ,
2117- UintTy :: U32 => (
2118- FullInt :: U ( u128:: from ( u32:: MIN ) ) ,
2119- FullInt :: U ( u128:: from ( u32:: MAX ) ) ,
2120- ) ,
2121- UintTy :: U64 => (
2122- FullInt :: U ( u128:: from ( u64:: MIN ) ) ,
2123- FullInt :: U ( u128:: from ( u64:: MAX ) ) ,
2124- ) ,
2090+ UintTy :: U8 => ( FullInt :: U ( u128:: from ( u8:: MIN ) ) , FullInt :: U ( u128:: from ( u8:: MAX ) ) ) ,
2091+ UintTy :: U16 => ( FullInt :: U ( u128:: from ( u16:: MIN ) ) , FullInt :: U ( u128:: from ( u16:: MAX ) ) ) ,
2092+ UintTy :: U32 => ( FullInt :: U ( u128:: from ( u32:: MIN ) ) , FullInt :: U ( u128:: from ( u32:: MAX ) ) ) ,
2093+ UintTy :: U64 => ( FullInt :: U ( u128:: from ( u64:: MIN ) ) , FullInt :: U ( u128:: from ( u64:: MAX ) ) ) ,
21252094 UintTy :: U128 => ( FullInt :: U ( u128:: MIN ) , FullInt :: U ( u128:: MAX ) ) ,
2126- UintTy :: Usize => (
2127- FullInt :: U ( usize:: MIN as u128 ) ,
2128- FullInt :: U ( usize:: MAX as u128 ) ,
2129- ) ,
2095+ UintTy :: Usize => ( FullInt :: U ( usize:: MIN as u128 ) , FullInt :: U ( usize:: MAX as u128 ) ) ,
21302096 } ) ,
21312097 _ => None ,
21322098 }
0 commit comments