From 844edfe44904da43bda981fbc0d7aefa0ff2bb2a Mon Sep 17 00:00:00 2001 From: Jubilee Young Date: Fri, 20 Sep 2024 16:12:25 -0700 Subject: compiler: reuse {un,}signed_fit in get_type_suggestion (nfc) no need for a weird macro when a self-explanatory `match` will do. --- compiler/rustc_abi/src/lib.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'compiler/rustc_abi/src') diff --git a/compiler/rustc_abi/src/lib.rs b/compiler/rustc_abi/src/lib.rs index 5668d8992c8..7bd2507d1ad 100644 --- a/compiler/rustc_abi/src/lib.rs +++ b/compiler/rustc_abi/src/lib.rs @@ -833,6 +833,28 @@ pub enum Integer { } impl Integer { + pub fn int_ty_str(self) -> &'static str { + use Integer::*; + match self { + I8 => "i8", + I16 => "i16", + I32 => "i32", + I64 => "i64", + I128 => "i128", + } + } + + pub fn uint_ty_str(self) -> &'static str { + use Integer::*; + match self { + I8 => "u8", + I16 => "u16", + I32 => "u32", + I64 => "u64", + I128 => "u128", + } + } + #[inline] pub fn size(self) -> Size { use Integer::*; -- cgit 1.4.1-3-g733a5