]> git.lizzy.rs Git - rust.git/commitdiff
Remove TyKind arg from report_bin_hex_error function
authorflip1995 <hello@philkrones.com>
Tue, 2 Apr 2019 14:57:12 +0000 (16:57 +0200)
committerflip1995 <hello@philkrones.com>
Wed, 3 Apr 2019 17:18:07 +0000 (19:18 +0200)
src/librustc_lint/types.rs

index fa106532662d18d2fbcffd17a356a409056ef060..c82985b549e8ee33513fcf83a4bb59233db227fc 100644 (file)
@@ -104,7 +104,7 @@ fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx hir::Expr) {
                                         report_bin_hex_error(
                                             cx,
                                             e,
-                                            ty::Int(t),
+                                            attr::IntType::SignedInt(t),
                                             repr_str,
                                             v,
                                             negative,
@@ -159,7 +159,7 @@ fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx hir::Expr) {
                                 report_bin_hex_error(
                                     cx,
                                     e,
-                                    ty::Uint(t),
+                                    attr::IntType::UnsignedInt(t),
                                     repr_str,
                                     lit_val,
                                     false,
@@ -364,29 +364,24 @@ macro_rules! find_fit {
             }
         }
 
-        #[cfg_attr(not(stage0), allow(usage_of_ty_tykind))]
         fn report_bin_hex_error(
             cx: &LateContext<'_, '_>,
             expr: &hir::Expr,
-            ty: ty::TyKind<'_>,
+            ty: attr::IntType,
             repr_str: String,
             val: u128,
             negative: bool,
         ) {
+            let size = layout::Integer::from_attr(&cx.tcx, ty).size();
             let (t, actually) = match ty {
-                ty::Int(t) => {
-                    let ity = attr::IntType::SignedInt(t);
-                    let size = layout::Integer::from_attr(&cx.tcx, ity).size();
+                attr::IntType::SignedInt(t) => {
                     let actually = sign_extend(val, size) as i128;
                     (format!("{:?}", t), actually.to_string())
                 }
-                ty::Uint(t) => {
-                    let ity = attr::IntType::UnsignedInt(t);
-                    let size = layout::Integer::from_attr(&cx.tcx, ity).size();
+                attr::IntType::UnsignedInt(t) => {
                     let actually = truncate(val, size);
                     (format!("{:?}", t), actually.to_string())
                 }
-                _ => bug!(),
             };
             let mut err = cx.struct_span_lint(
                 OVERFLOWING_LITERALS,