Update clippy for restructured format flags fields.

This commit is contained in:
Mara Bos 2023-01-13 13:56:51 +01:00
parent 0abf8a0617
commit be69002dd7

View File

@ -711,8 +711,8 @@ pub struct FormatSpec<'tcx> {
pub fill: Option<char>, pub fill: Option<char>,
/// Optionally specified alignment. /// Optionally specified alignment.
pub align: Alignment, pub align: Alignment,
/// Packed version of various flags provided, see [`rustc_parse_format::Flag`]. /// Whether all flag options are set to default (no flags specified).
pub flags: u32, pub no_flags: bool,
/// Represents either the maximum width or the integer precision. /// Represents either the maximum width or the integer precision.
pub precision: Count<'tcx>, pub precision: Count<'tcx>,
/// The minimum width, will be padded according to `width`/`align` /// The minimum width, will be padded according to `width`/`align`
@ -728,7 +728,7 @@ fn new(spec: rpf::FormatSpec<'_>, positions: ParamPosition, values: &FormatArgsV
Some(Self { Some(Self {
fill: spec.fill, fill: spec.fill,
align: spec.align, align: spec.align,
flags: spec.flags, no_flags: spec.sign.is_none() && !spec.alternate && !spec.zero_pad && spec.debug_hex.is_none(),
precision: Count::new( precision: Count::new(
FormatParamUsage::Precision, FormatParamUsage::Precision,
spec.precision, spec.precision,
@ -773,7 +773,7 @@ pub fn is_default_for_trait(&self) -> bool {
self.width.is_implied() self.width.is_implied()
&& self.precision.is_implied() && self.precision.is_implied()
&& self.align == Alignment::AlignUnknown && self.align == Alignment::AlignUnknown
&& self.flags == 0 && self.no_flags
} }
} }