Skip to content

Commit

Permalink
Rollup merge of rust-lang#130646 - workingjubilee:literally-factorize…
Browse files Browse the repository at this point in the history
…-int-lint, r=compiler-errors

compiler: factor out `OVERFLOWING_LITERALS` impl

This puts it into `rustc_lint/src/types/literal.rs`. It then uses the fact that it's easier to navigate the logic to identify something that can easily be factored out, as an instance of "why".
  • Loading branch information
matthiaskrgr committed Sep 21, 2024
2 parents e6cf3bd + 844edfe commit 5770ba8
Show file tree
Hide file tree
Showing 3 changed files with 417 additions and 405 deletions.
22 changes: 22 additions & 0 deletions compiler/rustc_abi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;
Expand Down
Loading

0 comments on commit 5770ba8

Please sign in to comment.