##// END OF EJS Templates
rust: don't use a reference to a `Cow`...
Raphaël Gomès -
r50817:b6dc4802 default
parent child Browse files
Show More
@@ -912,7 +912,7 b" impl<'on_disk> DirstateMap<'on_disk> {"
912 })
912 })
913 }
913 }
914
914
915 fn count_dropped_path(unreachable_bytes: &mut u32, path: &Cow<HgPath>) {
915 fn count_dropped_path(unreachable_bytes: &mut u32, path: Cow<HgPath>) {
916 if let Cow::Borrowed(path) = path {
916 if let Cow::Borrowed(path) = path {
917 *unreachable_bytes += path.len() as u32
917 *unreachable_bytes += path.len() as u32
918 }
918 }
@@ -1124,7 +1124,10 b' impl OwningDirstateMap {'
1124 }
1124 }
1125 let mut had_copy_source = false;
1125 let mut had_copy_source = false;
1126 if let Some(source) = &node.copy_source {
1126 if let Some(source) = &node.copy_source {
1127 DirstateMap::count_dropped_path(unreachable_bytes, source);
1127 DirstateMap::count_dropped_path(
1128 unreachable_bytes,
1129 Cow::Borrowed(source),
1130 );
1128 had_copy_source = true;
1131 had_copy_source = true;
1129 node.copy_source = None
1132 node.copy_source = None
1130 }
1133 }
@@ -1144,7 +1147,7 b' impl OwningDirstateMap {'
1144 nodes.remove_entry(first_path_component).unwrap();
1147 nodes.remove_entry(first_path_component).unwrap();
1145 DirstateMap::count_dropped_path(
1148 DirstateMap::count_dropped_path(
1146 unreachable_bytes,
1149 unreachable_bytes,
1147 key.full_path(),
1150 Cow::Borrowed(key.full_path()),
1148 )
1151 )
1149 }
1152 }
1150 Ok(Some((dropped, remove)))
1153 Ok(Some((dropped, remove)))
@@ -1343,7 +1346,10 b' impl OwningDirstateMap {'
1343 *count = count
1346 *count = count
1344 .checked_sub(1)
1347 .checked_sub(1)
1345 .expect("nodes_with_copy_source_count should be >= 0");
1348 .expect("nodes_with_copy_source_count should be >= 0");
1346 DirstateMap::count_dropped_path(unreachable_bytes, source);
1349 DirstateMap::count_dropped_path(
1350 unreachable_bytes,
1351 Cow::Borrowed(source),
1352 );
1347 }
1353 }
1348 node.copy_source.take().map(Cow::into_owned)
1354 node.copy_source.take().map(Cow::into_owned)
1349 }))
1355 }))
General Comments 0
You need to be logged in to leave comments. Login now