diff --git a/src/format/parsed.rs b/src/format/parsed.rs index 06b1b2efb3..1a09721d9a 100644 --- a/src/format/parsed.rs +++ b/src/format/parsed.rs @@ -225,7 +225,7 @@ impl Parsed { /// (`false` for AM, `true` for PM) #[inline] pub fn set_ampm(&mut self, value: bool) -> ParseResult<()> { - set_if_consistent(&mut self.hour_div_12, if value { 1 } else { 0 }) + set_if_consistent(&mut self.hour_div_12, u32::from(value)) } /// Tries to set the [`hour_mod_12`](#structfield.hour_mod_12) field from diff --git a/src/naive/time/mod.rs b/src/naive/time/mod.rs index d0354a3f0a..c90cba8619 100644 --- a/src/naive/time/mod.rs +++ b/src/naive/time/mod.rs @@ -652,13 +652,7 @@ impl NaiveTime { // `secs` may contain a leap second yet to be counted let adjust = match self.secs.cmp(&rhs.secs) { - Ordering::Greater => { - if rhs.frac >= 1_000_000_000 { - 1 - } else { - 0 - } - } + Ordering::Greater => i64::from(rhs.frac >= 1_000_000_000), Ordering::Equal => 0, Ordering::Less => { if self.frac >= 1_000_000_000 {