Skip to content

Commit 63a91c2

Browse files
committed
Rollup merge of rust-lang#22916 - rprichard:fmt-num-cleanup, r=alexcrichton
* Make num::UpperHex private. I was unable to determine why this struct is public. The num module itself is not public, and the UpperHex struct is not referenced anywhere in the core::fmt module. (Only the UpperHex trait is reference.) num::LowerHex is not public. * Remove the suffix parameters from the macros that generate integral display traits. The code to print the Debug::fmt suffixes was removed when Show was renamed to Debug. It was an intentional change. From RFC 0565: * Focus on the *runtime* aspects of a type; repeating information such as suffixes for integer literals is not generally useful since that data is readily available from the type definition. * Because Show was renamed to Debug, rename show! to debug!.
2 parents 24a840d + c1c02d9 commit 63a91c2

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

src/libcore/fmt/num.rs

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ struct LowerHex;
8484

8585
/// A hexadecimal (base 16) radix, formatted with upper-case characters
8686
#[derive(Clone, PartialEq)]
87-
pub struct UpperHex;
87+
struct UpperHex;
8888

8989
macro_rules! radix {
9090
($T:ident, $base:expr, $prefix:expr, $($x:pat => $conv:expr),+) => {
@@ -156,7 +156,7 @@ pub fn radix<T>(x: T, base: u8) -> RadixFmt<T, Radix> {
156156
}
157157

158158
macro_rules! radix_fmt {
159-
($T:ty as $U:ty, $fmt:ident, $S:expr) => {
159+
($T:ty as $U:ty, $fmt:ident) => {
160160
#[stable(feature = "rust1", since = "1.0.0")]
161161
impl fmt::Debug for RadixFmt<$T, Radix> {
162162
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
@@ -182,8 +182,8 @@ macro_rules! int_base {
182182
}
183183
}
184184

185-
macro_rules! show {
186-
($T:ident with $S:expr) => {
185+
macro_rules! debug {
186+
($T:ident) => {
187187
#[stable(feature = "rust1", since = "1.0.0")]
188188
impl fmt::Debug for $T {
189189
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
@@ -194,27 +194,24 @@ macro_rules! show {
194194
}
195195
macro_rules! integer {
196196
($Int:ident, $Uint:ident) => {
197-
integer! { $Int, $Uint, stringify!($Int), stringify!($Uint) }
198-
};
199-
($Int:ident, $Uint:ident, $SI:expr, $SU:expr) => {
200197
int_base! { Display for $Int as $Int -> Decimal }
201198
int_base! { Binary for $Int as $Uint -> Binary }
202199
int_base! { Octal for $Int as $Uint -> Octal }
203200
int_base! { LowerHex for $Int as $Uint -> LowerHex }
204201
int_base! { UpperHex for $Int as $Uint -> UpperHex }
205-
radix_fmt! { $Int as $Int, fmt_int, $SI }
206-
show! { $Int with $SI }
202+
radix_fmt! { $Int as $Int, fmt_int }
203+
debug! { $Int }
207204

208205
int_base! { Display for $Uint as $Uint -> Decimal }
209206
int_base! { Binary for $Uint as $Uint -> Binary }
210207
int_base! { Octal for $Uint as $Uint -> Octal }
211208
int_base! { LowerHex for $Uint as $Uint -> LowerHex }
212209
int_base! { UpperHex for $Uint as $Uint -> UpperHex }
213-
radix_fmt! { $Uint as $Uint, fmt_int, $SU }
214-
show! { $Uint with $SU }
210+
radix_fmt! { $Uint as $Uint, fmt_int }
211+
debug! { $Uint }
215212
}
216213
}
217-
integer! { isize, usize, "i", "u" }
214+
integer! { isize, usize }
218215
integer! { i8, u8 }
219216
integer! { i16, u16 }
220217
integer! { i32, u32 }

0 commit comments

Comments
 (0)