From 78f13841e82cfe250f1434780fefb95e73695a43 Mon Sep 17 00:00:00 2001 From: Peltoche Date: Wed, 12 Dec 2018 11:17:32 +0100 Subject: [PATCH] Run cargo fmt --- src/app.rs | 18 ++++++++++++------ src/core.rs | 3 ++- src/display.rs | 3 ++- src/meta/date.rs | 3 ++- src/meta/name.rs | 28 +++++++++++++++++++++------- 5 files changed, 39 insertions(+), 16 deletions(-) diff --git a/src/app.rs b/src/app.rs index 44888dc..34e067f 100644 --- a/src/app.rs +++ b/src/app.rs @@ -10,7 +10,8 @@ pub fn build_app() -> App<'static, 'static> { .short("a") .long("all") .help("Do not ignore entries starting with ."), - ).arg( + ) + .arg( Arg::with_name("color") .long("color") .possible_value("always") @@ -18,27 +19,32 @@ pub fn build_app() -> App<'static, 'static> { .possible_value("never") .default_value("auto") .help("When to use terminal colours"), - ).arg( + ) + .arg( Arg::with_name("indicators") .short("F") .long("classify") .help("Append indicator (one of */=>@|) at the end of the file names"), - ).arg( + ) + .arg( Arg::with_name("long") .short("l") .long("long") .help("Display extended file metadata as a table"), - ).arg( + ) + .arg( Arg::with_name("oneline") .short("1") .long("oneline") .help("Display one entry per line"), - ).arg( + ) + .arg( Arg::with_name("recursive") .short("R") .long("recursive") .help("Recurse into directories"), - ).arg( + ) + .arg( Arg::with_name("tree") .long("tree") .help("Recurse into directories and present the result as a tree"), diff --git a/src/core.rs b/src/core.rs index 0fc8d83..adf8a12 100644 --- a/src/core.rs +++ b/src/core.rs @@ -91,7 +91,8 @@ impl Core { } else { None } - }).collect(); + }) + .collect(); self.run_inner(folder_dirs, depth); } else { diff --git a/src/display.rs b/src/display.rs index fe22111..3f8ef21 100644 --- a/src/display.rs +++ b/src/display.rs @@ -91,7 +91,8 @@ impl Display { .skip_while(|x| { code_size += 1; char::is_numeric(*x) - }).count(); + }) + .count(); nb_invisible_char += 6 + code_size; /* "[38;5;" + color number + "m" */ } diff --git a/src/meta/date.rs b/src/meta/date.rs index 90fc591..b684174 100644 --- a/src/meta/date.rs +++ b/src/meta/date.rs @@ -119,7 +119,8 @@ mod test { .strftime("%Y%m%d%H%M.%S") .unwrap() .to_string(), - ).arg(&file_path) + ) + .arg(&file_path) .status() .unwrap() .success(); diff --git a/src/meta/name.rs b/src/meta/name.rs index 9839c1d..85e87e9 100644 --- a/src/meta/name.rs +++ b/src/meta/name.rs @@ -1,5 +1,5 @@ -use icon::Icons; use color::{ColoredString, Colors, Elem}; +use icon::Icons; use meta::filetype::FileType; use std::cmp::{Ordering, PartialOrd}; use std::path::Path; @@ -39,7 +39,9 @@ impl Name { pub fn render(&self, colors: &Colors, icons: &Icons) -> ColoredString { let icon = icons.get(self); - let mut content = String::with_capacity(icon.len() + ICON_SPACE.len() +self.name.len() + 3 /* spaces */); + let mut content = String::with_capacity( + icon.len() + ICON_SPACE.len() + self.name.len() + 3, /* spaces */ + ); content += icon; content += ICON_SPACE; @@ -94,9 +96,9 @@ impl PartialEq for Name { #[cfg(test)] mod test { use super::Name; - use icon::Icons; use ansi_term::Colour; use color::{Colors, Theme}; + use icon::Icons; use meta::FileType; use meta::Permissions; use std::fs::{self, File}; @@ -119,7 +121,10 @@ mod test { let file_type = FileType::new(&meta, &Permissions::from(&meta)); let name = Name::new(&file_path, file_type); - assert_eq!(Colour::Fixed(184).paint(" file.txt"), name.render(&colors, &icons)); + assert_eq!( + Colour::Fixed(184).paint(" file.txt"), + name.render(&colors, &icons) + ); } #[test] @@ -136,7 +141,10 @@ mod test { let file_type = FileType::new(&meta, &Permissions::from(&meta)); let name = Name::new(&dir_path, file_type); - assert_eq!(Colour::Fixed(33).paint(" directory"), name.render(&colors, &icons)); + assert_eq!( + Colour::Fixed(33).paint(" directory"), + name.render(&colors, &icons) + ); } #[test] @@ -159,7 +167,10 @@ mod test { let file_type = FileType::new(&meta, &Permissions::from(&meta)); let name = Name::new(&symlink_path, file_type); - assert_eq!(Colour::Fixed(44).paint(" target.tmp"), name.render(&colors, &icons)); + assert_eq!( + Colour::Fixed(44).paint(" target.tmp"), + name.render(&colors, &icons) + ); } #[test] @@ -181,7 +192,10 @@ mod test { let file_type = FileType::new(&meta, &Permissions::from(&meta)); let name = Name::new(&pipe_path, file_type); - assert_eq!(Colour::Fixed(184).paint(" pipe.tmp"), name.render(&colors, &icons)); + assert_eq!( + Colour::Fixed(184).paint(" pipe.tmp"), + name.render(&colors, &icons) + ); } #[test]