Skip to content

Commit 2cb55c1

Browse files
author
Adam Simpson
committed
refactor: follow Clippy recommendations
1 parent 0cee91f commit 2cb55c1

File tree

3 files changed

+16
-19
lines changed

3 files changed

+16
-19
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "oscar"
3-
version = "0.1.20"
3+
version = "0.1.21"
44
authors = ["Adam Simpson <adam@heysparkbox.com>"]
55
edition = "2018"
66
description = "A CLI application to download videos from PBS. Ideally run in cron or another scheduler."

src/json.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ impl Episode {
6060

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

63-
return videos[0].proper_url();
63+
videos[0].proper_url()
6464
}
6565
}
6666

@@ -85,11 +85,11 @@ impl Video {
8585
return 3;
8686
}
8787

88-
return 99;
88+
99
8989
}
9090

9191
fn proper_url(&self) -> String {
92-
return self.url.to_string();
92+
self.url.to_string()
9393
}
9494
}
9595

src/main.rs

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -91,23 +91,20 @@ fn fetch_show_list() -> Result<json::Collections, Box<dyn std::error::Error>> {
9191
fn main() {
9292
let opts = Opt::from_args();
9393

94-
match opts.command {
95-
Some(Command::List) => {
96-
let mut list = fetch_show_list().unwrap_or_else(|e| {
97-
error!("List API request failed: {}", e);
98-
process::exit(1)
99-
});
100-
101-
list.tier_1.content.append(&mut list.tier_2.content);
102-
list.tier_1.content.append(&mut list.tier_3.content);
103-
104-
for item in list.tier_1.content.iter() {
105-
println!("{:?}", item.slug);
106-
}
94+
if let Some(Command::List) = opts.command {
95+
let mut list = fetch_show_list().unwrap_or_else(|e| {
96+
error!("List API request failed: {}", e);
97+
process::exit(1)
98+
});
99+
100+
list.tier_1.content.append(&mut list.tier_2.content);
101+
list.tier_1.content.append(&mut list.tier_3.content);
107102

108-
process::exit(0)
103+
for item in list.tier_1.content.iter() {
104+
println!("{:?}", item.slug);
109105
}
110-
None => {}
106+
107+
process::exit(0)
111108
}
112109

113110
if !opts.silent {

0 commit comments

Comments
 (0)