Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 1f7d148

Browse files
committed
Formatted
1 parent 1c50fbf commit 1f7d148

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

library/core/src/fmt/mod.rs

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -292,13 +292,7 @@ impl FormattingOptions {
292292
/// - no [`DebugAsHex`] output mode.
293293
#[unstable(feature = "formatting_options", issue = "118117")]
294294
pub const fn new() -> Self {
295-
Self {
296-
flags: 0,
297-
fill: ' ',
298-
align: None,
299-
width: None,
300-
precision: None,
301-
}
295+
Self { flags: 0, fill: ' ', align: None, width: None, precision: None }
302296
}
303297

304298
/// Sets or removes the sign (the `+` or the `-` flag).
@@ -311,9 +305,10 @@ impl FormattingOptions {
311305
/// - `-`: Currently not used
312306
#[unstable(feature = "formatting_options", issue = "118117")]
313307
pub const fn sign(&mut self, sign: Option<Sign>) -> &mut Self {
314-
self.flags = self.flags & !(1 << rt::Flag::SignMinus as u32 | 1 << rt::Flag::SignPlus as u32);
308+
self.flags =
309+
self.flags & !(1 << rt::Flag::SignMinus as u32 | 1 << rt::Flag::SignPlus as u32);
315310
match sign {
316-
None => {},
311+
None => {}
317312
Some(Sign::Plus) => self.flags |= 1 << rt::Flag::SignPlus as u32,
318313
Some(Sign::Minus) => self.flags |= 1 << rt::Flag::SignMinus as u32,
319314
}
@@ -397,9 +392,10 @@ impl FormattingOptions {
397392
/// hexadecimal or normal integers
398393
#[unstable(feature = "formatting_options", issue = "118117")]
399394
pub const fn debug_as_hex(&mut self, debug_as_hex: Option<DebugAsHex>) -> &mut Self {
400-
self.flags = self.flags & !(1 << rt::Flag::DebugUpperHex as u32 | 1 << rt::Flag::DebugLowerHex as u32);
395+
self.flags = self.flags
396+
& !(1 << rt::Flag::DebugUpperHex as u32 | 1 << rt::Flag::DebugLowerHex as u32);
401397
match debug_as_hex {
402-
None => {},
398+
None => {}
403399
Some(DebugAsHex::Upper) => self.flags |= 1 << rt::Flag::DebugUpperHex as u32,
404400
Some(DebugAsHex::Lower) => self.flags |= 1 << rt::Flag::DebugLowerHex as u32,
405401
}
@@ -453,7 +449,9 @@ impl FormattingOptions {
453449
pub const fn get_debug_as_hex(&self) -> Option<DebugAsHex> {
454450
const DEBUG_UPPER_BITFIELD: u32 = 1 << rt::Flag::DebugUpperHex as u32;
455451
const DEBUG_LOWER_BITFIELD: u32 = 1 << rt::Flag::DebugLowerHex as u32;
456-
match self.flags & ((1 << rt::Flag::DebugUpperHex as u32) | (1 << rt::Flag::DebugLowerHex as u32)) {
452+
match self.flags
453+
& ((1 << rt::Flag::DebugUpperHex as u32) | (1 << rt::Flag::DebugLowerHex as u32))
454+
{
457455
DEBUG_UPPER_BITFIELD => Some(DebugAsHex::Upper),
458456
DEBUG_LOWER_BITFIELD => Some(DebugAsHex::Lower),
459457
0 => None,

0 commit comments

Comments
 (0)