Skip to content

Commit

Permalink
refactor: follow Clippy recommendations
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Simpson committed Sep 2, 2020
1 parent 0cee91f commit 2cb55c1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "oscar"
version = "0.1.20"
version = "0.1.21"
authors = ["Adam Simpson <[email protected]>"]
edition = "2018"
description = "A CLI application to download videos from PBS. Ideally run in cron or another scheduler."
Expand Down
6 changes: 3 additions & 3 deletions src/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ impl Episode {

videos.sort_by(|a, b| a.quality_rating().cmp(&b.quality_rating()));

return videos[0].proper_url();
videos[0].proper_url()
}
}

Expand All @@ -85,11 +85,11 @@ impl Video {
return 3;
}

return 99;
99
}

fn proper_url(&self) -> String {
return self.url.to_string();
self.url.to_string()
}
}

Expand Down
27 changes: 12 additions & 15 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,23 +91,20 @@ fn fetch_show_list() -> Result<json::Collections, Box<dyn std::error::Error>> {
fn main() {
let opts = Opt::from_args();

match opts.command {
Some(Command::List) => {
let mut list = fetch_show_list().unwrap_or_else(|e| {
error!("List API request failed: {}", e);
process::exit(1)
});

list.tier_1.content.append(&mut list.tier_2.content);
list.tier_1.content.append(&mut list.tier_3.content);

for item in list.tier_1.content.iter() {
println!("{:?}", item.slug);
}
if let Some(Command::List) = opts.command {
let mut list = fetch_show_list().unwrap_or_else(|e| {
error!("List API request failed: {}", e);
process::exit(1)
});

list.tier_1.content.append(&mut list.tier_2.content);
list.tier_1.content.append(&mut list.tier_3.content);

process::exit(0)
for item in list.tier_1.content.iter() {
println!("{:?}", item.slug);
}
None => {}

process::exit(0)
}

if !opts.silent {
Expand Down

0 comments on commit 2cb55c1

Please sign in to comment.