diff --git a/src/display/inline.rs b/src/display/inline.rs index d334be0405..eae6d4f590 100644 --- a/src/display/inline.rs +++ b/src/display/inline.rs @@ -65,7 +65,7 @@ pub fn print( "{}", style::header( display_path, - extra_info, + extra_info.as_ref(), i + 1, hunks.len(), file_format, diff --git a/src/display/side_by_side.rs b/src/display/side_by_side.rs index e0a5102497..30372a6215 100644 --- a/src/display/side_by_side.rs +++ b/src/display/side_by_side.rs @@ -67,7 +67,7 @@ fn format_missing_line_num( /// Display `src` in a single column (e.g. a file removal or addition). fn display_single_column( display_path: &str, - old_path: &Option, + old_path: Option<&String>, file_format: &FileFormat, src_lines: &[String], side: Side, @@ -320,7 +320,7 @@ pub fn print( hunks: &[Hunk], display_options: &DisplayOptions, display_path: &str, - old_path: &Option, + old_path: Option<&String>, file_format: &FileFormat, lhs_src: &str, rhs_src: &str, @@ -667,7 +667,7 @@ mod tests { // Basic smoke test. let res_lines = display_single_column( "foo.py", - &None, + None, &FileFormat::SupportedLanguage(Language::Python), &["print(123)\n".to_string()], Side::Right, @@ -724,7 +724,7 @@ mod tests { &hunks, &DisplayOptions::default(), "foo-new.el", - &None, + None, &FileFormat::SupportedLanguage(Language::EmacsLisp), "foo", "bar", diff --git a/src/display/style.rs b/src/display/style.rs index 9ecfca0713..47c9ab8437 100644 --- a/src/display/style.rs +++ b/src/display/style.rs @@ -451,7 +451,7 @@ pub(crate) fn apply_line_number_color( pub fn header( display_path: &str, - extra_info: &Option, + extra_info: Option<&String>, hunk_num: usize, hunk_total: usize, file_format: &FileFormat, diff --git a/src/main.rs b/src/main.rs index 2c3e810585..20920dc7b6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -704,7 +704,7 @@ fn print_diff_result(display_options: &DisplayOptions, summary: &DiffResult) { "{}", display::style::header( &summary.display_path, - &summary.extra_info, + summary.extra_info.as_ref(), 1, 1, &summary.file_format, @@ -731,7 +731,7 @@ fn print_diff_result(display_options: &DisplayOptions, summary: &DiffResult) { "{}", display::style::header( &summary.display_path, - &summary.extra_info, + summary.extra_info.as_ref(), 1, 1, &summary.file_format, @@ -769,7 +769,7 @@ fn print_diff_result(display_options: &DisplayOptions, summary: &DiffResult) { hunks, display_options, &summary.display_path, - &summary.extra_info, + summary.extra_info.as_ref(), &summary.file_format, lhs_src, rhs_src, @@ -785,7 +785,7 @@ fn print_diff_result(display_options: &DisplayOptions, summary: &DiffResult) { "{}", display::style::header( &summary.display_path, - &summary.extra_info, + summary.extra_info.as_ref(), 1, 1, &FileFormat::Binary, @@ -806,7 +806,7 @@ fn print_diff_result(display_options: &DisplayOptions, summary: &DiffResult) { "{}", display::style::header( &summary.display_path, - &summary.extra_info, + summary.extra_info.as_ref(), 1, 1, &FileFormat::Binary,