Mercurial > public > mercurial-scm > hg-stable
diff rust/rhg/src/commands/status.rs @ 49987:58074252db3c
rust: run `cargo clippy`
These automatic fixes are good to have because they make the code
more idiomatic and less surprising.
The transform from `sort` -> `sort_unstable` is questionable, but this is
only in a test, so it doesn't matter in our case.
author | Rapha?l Gom?s <rgomes@octobus.net> |
---|---|
date | Mon, 09 Jan 2023 17:40:03 +0100 |
parents | 678588b01af1 |
children | 70b4c7af9cdb |
line wrap: on
line diff
--- a/rust/rhg/src/commands/status.rs Fri Jan 06 18:52:04 2023 +0100 +++ b/rust/rhg/src/commands/status.rs Mon Jan 09 17:40:03 2023 +0100 @@ -169,7 +169,7 @@ } fn has_unfinished_merge(repo: &Repo) -> Result<bool, CommandError> { - return Ok(repo.dirstate_parents()?.is_merge()); + Ok(repo.dirstate_parents()?.is_merge()) } fn has_unfinished_state(repo: &Repo) -> Result<bool, CommandError> { @@ -192,7 +192,7 @@ return Ok(true); } } - return Ok(false); + Ok(false) } pub fn run(invocation: &crate::CliInvocation) -> Result<(), CommandError> { @@ -244,12 +244,10 @@ let repo = invocation.repo?; - if verbose { - if has_unfinished_state(repo)? { - return Err(CommandError::unsupported( - "verbose status output is not supported by rhg (and is needed because we're in an unfinished operation)", - )); - }; + if verbose && has_unfinished_state(repo)? { + return Err(CommandError::unsupported( + "verbose status output is not supported by rhg (and is needed because we're in an unfinished operation)", + )); } let mut dmap = repo.dirstate_map_mut()?; @@ -271,7 +269,7 @@ let after_status = |res: StatusResult| -> Result<_, CommandError> { let (mut ds_status, pattern_warnings) = res?; for warning in pattern_warnings { - ui.write_stderr(&print_pattern_file_warning(&warning, &repo))?; + ui.write_stderr(&print_pattern_file_warning(&warning, repo))?; } for (path, error) in ds_status.bad { @@ -408,7 +406,7 @@ ui.write_stderr(&msg)?; } sparse::SparseWarning::Pattern(e) => { - ui.write_stderr(&print_pattern_file_warning(e, &repo))?; + ui.write_stderr(&print_pattern_file_warning(e, repo))?; } } }