# HG changeset patch # User Raphaël Gomès # Date 1703080716 -3600 # Node ID eab5b061cd48f24e2741d0d6f5ea2b5f893fbace # Parent ceeb8fa23cc82065c5c7b689d8cbed60d4d6913e rust-clippy: simplify `match` to `if let` This was hinted at by clippy, and makes it more obvious that nothing is happening in the `None` case. diff -r ceeb8fa23cc8 -r eab5b061cd48 rust/rhg/src/commands/status.rs --- a/rust/rhg/src/commands/status.rs Fri Dec 01 22:56:08 2023 +0100 +++ b/rust/rhg/src/commands/status.rs Wed Dec 20 14:58:36 2023 +0100 @@ -446,54 +446,51 @@ }; let (narrow_matcher, narrow_warnings) = narrow::matcher(repo)?; - match revpair { - Some((rev1, rev2)) => { - let mut ds_status = DirstateStatus::default(); - if list_copies { - return Err(CommandError::unsupported( - "status --rev --rev with copy information is not implemented yet", - )); - } + if let Some((rev1, rev2)) = revpair { + let mut ds_status = DirstateStatus::default(); + if list_copies { + return Err(CommandError::unsupported( + "status --rev --rev with copy information is not implemented yet", + )); + } - let stat = hg::operations::status_rev_rev_no_copies( - repo, - rev1, - rev2, - narrow_matcher, - )?; - for entry in stat.iter() { - let (path, status) = entry?; - let path = StatusPath { - path: Cow::Borrowed(path), - copy_source: None, - }; - match status { - hg::operations::DiffStatus::Removed => { - if display_states.removed { - ds_status.removed.push(path) - } + let stat = hg::operations::status_rev_rev_no_copies( + repo, + rev1, + rev2, + narrow_matcher, + )?; + for entry in stat.iter() { + let (path, status) = entry?; + let path = StatusPath { + path: Cow::Borrowed(path), + copy_source: None, + }; + match status { + hg::operations::DiffStatus::Removed => { + if display_states.removed { + ds_status.removed.push(path) } - hg::operations::DiffStatus::Added => { - if display_states.added { - ds_status.added.push(path) - } + } + hg::operations::DiffStatus::Added => { + if display_states.added { + ds_status.added.push(path) } - hg::operations::DiffStatus::Modified => { - if display_states.modified { - ds_status.modified.push(path) - } + } + hg::operations::DiffStatus::Modified => { + if display_states.modified { + ds_status.modified.push(path) } - hg::operations::DiffStatus::Matching => { - if display_states.clean { - ds_status.clean.push(path) - } + } + hg::operations::DiffStatus::Matching => { + if display_states.clean { + ds_status.clean.push(path) } } } - output.output(display_states, ds_status)?; - return Ok(()); } - None => (), + output.output(display_states, ds_status)?; + return Ok(()); } let (sparse_matcher, sparse_warnings) = sparse::matcher(repo)?;