@@ -357,10 +357,8 @@ fn process_changes(
357357
358358impl UnblamedHunk {
359359 fn shift_by ( mut self , suspect : ObjectId , offset : Offset ) -> Self {
360- if let Some ( position) = self . suspects . iter ( ) . position ( |entry| entry. 0 == suspect) {
361- if let Some ( ( _, ref mut range_in_suspect) ) = self . suspects . get_mut ( position) {
362- * range_in_suspect = range_in_suspect. shift_by ( offset) ;
363- }
360+ if let Some ( entry) = self . suspects . iter_mut ( ) . find ( |entry| entry. 0 == suspect) {
361+ entry. 1 = entry. 1 . shift_by ( offset) ;
364362 }
365363 self
366364 }
@@ -407,20 +405,16 @@ impl UnblamedHunk {
407405 /// This is like [`Self::pass_blame()`], but easier to use in places where the 'passing' is
408406 /// done 'inline'.
409407 fn passed_blame ( mut self , from : ObjectId , to : ObjectId ) -> Self {
410- if let Some ( position) = self . suspects . iter ( ) . position ( |entry| entry. 0 == from) {
411- if let Some ( ( ref mut commit_id, _) ) = self . suspects . get_mut ( position) {
412- * commit_id = to;
413- }
408+ if let Some ( entry) = self . suspects . iter_mut ( ) . find ( |entry| entry. 0 == from) {
409+ entry. 0 = to;
414410 }
415411 self
416412 }
417413
418414 /// Transfer all ranges from the commit at `from` to the commit at `to`.
419415 fn pass_blame ( & mut self , from : ObjectId , to : ObjectId ) {
420- if let Some ( position) = self . suspects . iter ( ) . position ( |entry| entry. 0 == from) {
421- if let Some ( ( ref mut commit_id, _) ) = self . suspects . get_mut ( position) {
422- * commit_id = to;
423- }
416+ if let Some ( entry) = self . suspects . iter_mut ( ) . find ( |entry| entry. 0 == from) {
417+ entry. 0 = to;
424418 }
425419 }
426420
0 commit comments