diff options
| author | Jubilee Young <workingjubilee@gmail.com> | 2024-09-20 16:12:25 -0700 |
|---|---|---|
| committer | Jubilee Young <workingjubilee@gmail.com> | 2024-09-20 17:19:27 -0700 |
| commit | 844edfe44904da43bda981fbc0d7aefa0ff2bb2a (patch) | |
| tree | c24a825193ac197f9956a8bd38ad2cdc0d090d6c /compiler/rustc_abi/src | |
| parent | 2db62e68936178901bcdee2c1e8d4a87ce10b445 (diff) | |
| download | rust-844edfe44904da43bda981fbc0d7aefa0ff2bb2a.tar.gz rust-844edfe44904da43bda981fbc0d7aefa0ff2bb2a.zip | |
compiler: reuse {un,}signed_fit in get_type_suggestion (nfc)
no need for a weird macro when a self-explanatory `match` will do.
Diffstat (limited to 'compiler/rustc_abi/src')
| -rw-r--r-- | compiler/rustc_abi/src/lib.rs | 22 |
1 files changed, 22 insertions, 0 deletions
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::*; |
