@@ -445,18 +445,21 @@ impl<'a> Printer for InteractivePrinter<'a> {
445445 return Ok(());
446446 }
447447 };
448+
448449 // skip syntax highlighting on long lines
449− if line.len() > 1024 * 16 {
450− let mut empty = highlighter_from_set
451− .highlighter
452− .highlight(&"\n", highlighter_from_set.syntax_set);
453− empty[0].1 = line.as_ref();
454− empty
455− } else {
456− highlighter_from_set
457− .highlighter
458− .highlight(&line, highlighter_from_set.syntax_set)
450+ let too_long = line.len() > 1024 * 16;
451+
452+ let for_highlighting: &str = if too_long { "\n" } else { &line };
453+
454+ let mut highlighted_line = highlighter_from_set
455+ .highlighter
456+ .highlight(for_highlighting, highlighter_from_set.syntax_set);
457+
458+ if too_long {
459+ highlighted_line[0].1 = &line;
459460 }
461+
462+ highlighted_line
460463 };
461464
462465 if out_of_range {