From 438f3df34567448c915a262c47bf05cb67fcc884 Mon Sep 17 00:00:00 2001 From: sharkdp Date: Mon, 7 May 2018 22:26:06 +0200 Subject: [PATCH] Paint STDOUT bold, unify writeln statement --- src/printer.rs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/printer.rs b/src/printer.rs index ddcfa133..6f046bb2 100644 --- a/src/printer.rs +++ b/src/printer.rs @@ -51,14 +51,12 @@ impl<'a> Printer<'a> { self.colors.grid.paint("│"), )?; - match filename { - None => { - writeln!(self.handle, "STDIN",)?; - } - Some(filename) => { - writeln!(self.handle, "File {}", self.colors.filename.paint(filename))?; - } - } + writeln!( + self.handle, + "{}{}", + filename.map_or("", |_| "File: "), + self.colors.filename.paint(filename.unwrap_or("STDIN")) + )?; self.print_horizontal_line('┼') }