Skip to content

Commit db202e3

Browse files
authored
Rollup merge of rust-lang#45081 - tamird:fmt-cleanup, r=alexcrichton
fmt: misc cleanup
2 parents 48cb6af + 41b105b commit db202e3

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

src/libcore/fmt/builders.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use fmt::{self, FlagV1};
11+
use fmt;
1212

1313
struct PadAdapter<'a, 'b: 'a> {
1414
fmt: &'a mut fmt::Formatter<'b>,
@@ -140,7 +140,7 @@ impl<'a, 'b: 'a> DebugStruct<'a, 'b> {
140140
}
141141

142142
fn is_pretty(&self) -> bool {
143-
self.fmt.flags() & (1 << (FlagV1::Alternate as usize)) != 0
143+
self.fmt.alternate()
144144
}
145145
}
146146

@@ -233,7 +233,7 @@ impl<'a, 'b: 'a> DebugTuple<'a, 'b> {
233233
}
234234

235235
fn is_pretty(&self) -> bool {
236-
self.fmt.flags() & (1 << (FlagV1::Alternate as usize)) != 0
236+
self.fmt.alternate()
237237
}
238238
}
239239

@@ -277,7 +277,7 @@ impl<'a, 'b: 'a> DebugInner<'a, 'b> {
277277
}
278278

279279
fn is_pretty(&self) -> bool {
280-
self.fmt.flags() & (1 << (FlagV1::Alternate as usize)) != 0
280+
self.fmt.alternate()
281281
}
282282
}
283283

@@ -519,6 +519,6 @@ impl<'a, 'b: 'a> DebugMap<'a, 'b> {
519519
}
520520

521521
fn is_pretty(&self) -> bool {
522-
self.fmt.flags() & (1 << (FlagV1::Alternate as usize)) != 0
522+
self.fmt.alternate()
523523
}
524524
}

src/libcore/fmt/mod.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,6 @@ impl<'a> ArgumentV1<'a> {
322322

323323
// flags available in the v1 format of format_args
324324
#[derive(Copy, Clone)]
325-
#[allow(dead_code)] // SignMinus isn't currently used
326325
enum FlagV1 { SignPlus, SignMinus, Alternate, SignAwareZeroPad, }
327326

328327
impl<'a> Arguments<'a> {
@@ -1276,7 +1275,7 @@ impl<'a> Formatter<'a> {
12761275
write(self.buf, fmt)
12771276
}
12781277

1279-
/// Flags for formatting (packed version of rt::Flag)
1278+
/// Flags for formatting
12801279
#[stable(feature = "rust1", since = "1.0.0")]
12811280
pub fn flags(&self) -> u32 { self.flags }
12821281

0 commit comments

Comments
 (0)