Skip to content

Commit

Permalink
Switch to 2024 idiom
Browse files Browse the repository at this point in the history
  • Loading branch information
djc committed Feb 21, 2025
1 parent 7f6cf5e commit 1f345fd
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/format/parsed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,12 @@ pub struct Parsed {
/// and if it is empty, set `old` to `new` as well.
#[inline]
fn set_if_consistent<T: PartialEq>(old: &mut Option<T>, new: T) -> ParseResult<()> {
if let Some(ref old) = *old {
if *old == new { Ok(()) } else { Err(IMPOSSIBLE) }
} else {
*old = Some(new);
Ok(())
match old {
Some(old) if *old != new => Err(IMPOSSIBLE),
_ => {
*old = Some(new);
Ok(())
}
}
}

Expand Down

0 comments on commit 1f345fd

Please sign in to comment.