Mercurial > public > mercurial-scm > hg
diff rust/hg-core/src/copy_tracing.rs @ 49930:e98fd81bb151
rust-clippy: fix most warnings in `hg-core`
All of these are simple changes that for the most part are clear improvements
and the rest are at most equivalent.
The remaining warnings have to be fixed either with a bigger refactor like for
the nested "revlog" module, or in the dependency `bytes-cast`, which we own.
This will be done sometime in the future.
author | Rapha?l Gom?s <rgomes@octobus.net> |
---|---|
date | Mon, 09 Jan 2023 19:18:43 +0100 |
parents | 321e2b7bc95c |
children | 83437ad8fe3d |
line wrap: on
line diff
--- a/rust/hg-core/src/copy_tracing.rs Mon Jan 09 19:14:14 2023 +0100 +++ b/rust/hg-core/src/copy_tracing.rs Mon Jan 09 19:18:43 2023 +0100 @@ -59,7 +59,7 @@ Self { rev, path: winner.path, - overwritten: overwritten, + overwritten, } } @@ -489,7 +489,7 @@ if cs1 == cs2 { cs1.mark_delete(current_rev); } else { - cs1.mark_delete_with_pair(current_rev, &cs2); + cs1.mark_delete_with_pair(current_rev, cs2); } e2.insert(cs1.clone()); } @@ -513,15 +513,14 @@ ) { let dest = path_map.tokenize(path_dest); let source = path_map.tokenize(path_source); - let entry; - if let Some(v) = base_copies.get(&source) { - entry = match &v.path { + let entry = if let Some(v) = base_copies.get(&source) { + match &v.path { Some(path) => Some((*(path)).to_owned()), None => Some(source.to_owned()), } } else { - entry = Some(source.to_owned()); - } + Some(source.to_owned()) + }; // Each new entry is introduced by the children, we // record this information as we will need it to take // the right decision when merging conflicting copy @@ -563,17 +562,15 @@ MergePick::Major | MergePick::Any => (src_major, src_minor), MergePick::Minor => (src_minor, src_major), }; - MergeResult::UseNewValue(CopySource::new_from_merge( + MergeResult::NewValue(CopySource::new_from_merge( current_merge, winner, loser, )) } else { match pick { - MergePick::Any | MergePick::Major => { - MergeResult::UseRightValue - } - MergePick::Minor => MergeResult::UseLeftValue, + MergePick::Any | MergePick::Major => MergeResult::RightValue, + MergePick::Minor => MergeResult::LeftValue, } } })