Remove unnecessary scope

This commit is contained in:
sharkdp 2018-10-07 10:09:10 +02:00
parent e30e1bab2e
commit da09f3877b

View File

@ -84,27 +84,25 @@ impl<'b> Controller<'b> {
let mut line_number: usize = 1;
while reader.read_until(b'\n', &mut line_buffer)? > 0 {
{
match line_ranges {
&Some(ref range) => {
if line_number < range.lower {
// Call the printer in case we need to call the syntax highlighter
// for this line. However, set `out_of_range` to `true`.
printer.print_line(true, writer, line_number, &line_buffer)?;
} else if line_number > range.upper {
// no more lines in range, exit early
break;
} else {
printer.print_line(false, writer, line_number, &line_buffer)?;
}
}
&None => {
match line_ranges {
&Some(ref range) => {
if line_number < range.lower {
// Call the printer in case we need to call the syntax highlighter
// for this line. However, set `out_of_range` to `true`.
printer.print_line(true, writer, line_number, &line_buffer)?;
} else if line_number > range.upper {
// no more lines in range, exit early
break;
} else {
printer.print_line(false, writer, line_number, &line_buffer)?;
}
}
line_number += 1;
&None => {
printer.print_line(false, writer, line_number, &line_buffer)?;
}
}
line_number += 1;
line_buffer.clear();
}
Ok(())