diff --git a/src/listing.rs b/src/listing.rs index f998481..779fdb0 100644 --- a/src/listing.rs +++ b/src/listing.rs @@ -147,7 +147,7 @@ impl fmt::Display for Listing { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!( f, - "{}{}{}{}{}{}{}{}{}{} {:>4}:{:<4} {:>10} ", + "{}{}{}{}{}{}{}{}{}{} {:>4}:{:<4} ", match self.kind { Kind::Normal(_) => "-", Kind::HardLink(_) => "L", @@ -199,11 +199,11 @@ impl fmt::Display for Listing { }, self.uid, self.gid, - match self.kind { - Kind::Normal(s) => s, - _ => 0, - }, )?; + match self.kind { + Kind::Normal(s) => write!(f, "{s:>10} "), + _ => write!(f, "{:>10}", "-"), + }?; match NaiveDateTime::from_timestamp_opt(self.mtime as i64, 0) { Some(dt) => write!(f, "{dt} ")?, _ => write!(f, "{:>19} ", self.mtime)?, @@ -266,7 +266,7 @@ impl Listing { #[cfg(feature = "color")] pub fn print_color(&self) -> Result<(), Error> { print!( - "{}{}{}{}{}{}{}{}{}{} {:>4}:{:<4} {:>10} ", + "{}{}{}{}{}{}{}{}{}{} {:>4}:{:<4} ", match self.kind { Kind::Normal(_) => "-", Kind::HardLink(_) => "L", @@ -318,11 +318,11 @@ impl Listing { }, self.uid, self.gid, - match self.kind { - Kind::Normal(s) => s, - _ => 0, - }, ); + match self.kind { + Kind::Normal(s) => write!(f, "{s:>10} "), + _ => write!(f, "{:>10}", "-"), + }?; match NaiveDateTime::from_timestamp_opt(self.mtime as i64, 0) { Some(dt) => print!("{dt} "), _ => print!("{:>19} ", self.mtime),