diff --git a/src/display/hunks.rs b/src/display/hunks.rs index 3b952fd6fc..1e5d1e578a 100644 --- a/src/display/hunks.rs +++ b/src/display/hunks.rs @@ -595,10 +595,10 @@ fn either_side_equal( false } -pub fn matched_lines_for_hunk( - matched_lines: &[(Option, Option)], +pub fn matched_lines_for_hunk<'a>( + matched_lines: &'a [(Option, Option)], hunk: &Hunk, -) -> Vec<(Option, Option)> { +) -> &'a [(Option, Option)] { let mut hunk_lhs_novel = hunk.novel_lhs.iter().copied().collect::>(); hunk_lhs_novel.sort(); @@ -645,7 +645,7 @@ pub fn matched_lines_for_hunk( end_i = matched_lines.len(); } - matched_lines[start_i..end_i].to_vec() + &matched_lines[start_i..end_i] } #[cfg(test)] diff --git a/src/display/side_by_side.rs b/src/display/side_by_side.rs index 72f5ce73fd..eac5c212bd 100644 --- a/src/display/side_by_side.rs +++ b/src/display/side_by_side.rs @@ -406,27 +406,27 @@ pub fn print( let source_dims = SourceDimensions::new( display_options.display_width, - &aligned_lines, + aligned_lines, &lhs_lines, &rhs_lines, ); for (lhs_line_num, rhs_line_num) in aligned_lines { let lhs_line_novel = highlight_as_novel( - lhs_line_num, + *lhs_line_num, &lhs_lines, - rhs_line_num, + *rhs_line_num, &lhs_lines_with_novel, ); let rhs_line_novel = highlight_as_novel( - rhs_line_num, + *rhs_line_num, &rhs_lines, - lhs_line_num, + *lhs_line_num, &rhs_lines_with_novel, ); let (display_lhs_line_num, display_rhs_line_num) = display_line_nums( - lhs_line_num, - rhs_line_num, + *lhs_line_num, + *rhs_line_num, &source_dims, display_options.use_color, display_options.background_color, @@ -554,10 +554,10 @@ pub fn print( } if lhs_line_num.is_some() { - prev_lhs_line_num = lhs_line_num; + prev_lhs_line_num = *lhs_line_num; } if rhs_line_num.is_some() { - prev_rhs_line_num = rhs_line_num; + prev_rhs_line_num = *rhs_line_num; } } println!();