# HG changeset patch # User Raphaël Gomès # Date 1673285124 -3600 # Node ID b6dc4802e7efdbae7a259f1865d2731481897b1e # Parent 5fff90c7ea9d15ca39036be0357a4be635b1137b rust: don't use a reference to a `Cow` This was caught by `clippy`. diff -r 5fff90c7ea9d -r b6dc4802e7ef rust/hg-core/src/dirstate_tree/dirstate_map.rs --- a/rust/hg-core/src/dirstate_tree/dirstate_map.rs Mon Jan 09 18:22:46 2023 +0100 +++ b/rust/hg-core/src/dirstate_tree/dirstate_map.rs Mon Jan 09 18:25:24 2023 +0100 @@ -912,7 +912,7 @@ }) } - fn count_dropped_path(unreachable_bytes: &mut u32, path: &Cow) { + fn count_dropped_path(unreachable_bytes: &mut u32, path: Cow) { if let Cow::Borrowed(path) = path { *unreachable_bytes += path.len() as u32 } @@ -1124,7 +1124,10 @@ } let mut had_copy_source = false; if let Some(source) = &node.copy_source { - DirstateMap::count_dropped_path(unreachable_bytes, source); + DirstateMap::count_dropped_path( + unreachable_bytes, + Cow::Borrowed(source), + ); had_copy_source = true; node.copy_source = None } @@ -1144,7 +1147,7 @@ nodes.remove_entry(first_path_component).unwrap(); DirstateMap::count_dropped_path( unreachable_bytes, - key.full_path(), + Cow::Borrowed(key.full_path()), ) } Ok(Some((dropped, remove))) @@ -1343,7 +1346,10 @@ *count = count .checked_sub(1) .expect("nodes_with_copy_source_count should be >= 0"); - DirstateMap::count_dropped_path(unreachable_bytes, source); + DirstateMap::count_dropped_path( + unreachable_bytes, + Cow::Borrowed(source), + ); } node.copy_source.take().map(Cow::into_owned) }))