Skip to content

Commit 5770ba8

Browse files
authored
Rollup merge of #130646 - workingjubilee:literally-factorize-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".
2 parents e6cf3bd + 844edfe commit 5770ba8

File tree

3 files changed

+417
-405
lines changed

3 files changed

+417
-405
lines changed

compiler/rustc_abi/src/lib.rs

+22
Original file line numberDiff line numberDiff line change
@@ -833,6 +833,28 @@ pub enum Integer {
833833
}
834834

835835
impl Integer {
836+
pub fn int_ty_str(self) -> &'static str {
837+
use Integer::*;
838+
match self {
839+
I8 => "i8",
840+
I16 => "i16",
841+
I32 => "i32",
842+
I64 => "i64",
843+
I128 => "i128",
844+
}
845+
}
846+
847+
pub fn uint_ty_str(self) -> &'static str {
848+
use Integer::*;
849+
match self {
850+
I8 => "u8",
851+
I16 => "u16",
852+
I32 => "u32",
853+
I64 => "u64",
854+
I128 => "u128",
855+
}
856+
}
857+
836858
#[inline]
837859
pub fn size(self) -> Size {
838860
use Integer::*;

0 commit comments

Comments
 (0)