From 144a829d82db142d1f6ae76adf49dddd77751428 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sat, 22 Dec 2018 02:59:15 -0500 Subject: cargo fmt --- src/cmd/recommend.rs | 53 +++++++++++++++++++++++++++++++--------------------- 1 file changed, 32 insertions(+), 21 deletions(-) (limited to 'src/cmd/recommend.rs') diff --git a/src/cmd/recommend.rs b/src/cmd/recommend.rs index 2f613fa..1d8eecc 100644 --- a/src/cmd/recommend.rs +++ b/src/cmd/recommend.rs @@ -19,40 +19,48 @@ pub fn subcommand<'a, 'b>() -> clap::App<'a, 'b> { .arg( clap::Arg::with_name("count") .default_value("20") - .help("number of results to return") + .help("number of results to return"), ) .arg( clap::Arg::with_name("random") .long("random") - .help("picks randomly instead of by weight") + .help("picks randomly instead of by weight"), ) .arg( clap::Arg::with_name("album") .long("album") - .help("also choose a random album by the chosen artists") + .help("also choose a random album by the chosen artists"), ) .arg( clap::Arg::with_name("include") .long("include") .default_value("yearly") - .possible_values(&["all", "yearly", "monthly", "weekly"]) + .possible_values(&["all", "yearly", "monthly", "weekly"]), ) .arg( clap::Arg::with_name("exclude") .long("exclude") .default_value("weekly") - .possible_values(&["all", "yearly", "monthly", "weekly", "none"]) + .possible_values(&[ + "all", "yearly", "monthly", "weekly", "none", + ]), ) } impl Command { - pub fn new<'a>(matches: &clap::ArgMatches<'a>) -> failure::Fallible { + pub fn new<'a>( + matches: &clap::ArgMatches<'a>, + ) -> failure::Fallible { Ok(Command { count: matches.value_of("count").unwrap().parse()?, random: matches.is_present("random"), album: matches.is_present("album"), - include: db::parse_timewindow(matches.value_of("include").unwrap()), - exclude: db::parse_timewindow(matches.value_of("exclude").unwrap()), + include: db::parse_timewindow( + matches.value_of("include").unwrap(), + ), + exclude: db::parse_timewindow( + matches.value_of("exclude").unwrap(), + ), db: db::DB::new(&util::db_path()?)?, }) @@ -65,21 +73,24 @@ impl super::Command for Command { self.count, self.random, self.include, - self.exclude + self.exclude, )?; if self.album { - artists = artists.iter().map(|artist| { - Ok(format!( - "{} - {}", - artist, - self.db.recommend_album( - &artist, - self.random, - self.include, - self.exclude - )? - )) - }).collect::>>()?; + artists = artists + .iter() + .map(|artist| { + Ok(format!( + "{} - {}", + artist, + self.db.recommend_album( + &artist, + self.random, + self.include, + self.exclude + )? + )) + }) + .collect::>>()?; } for line in artists { println!("{}", line); -- cgit v1.2.3-54-g00ecf