Skip to content

Commit daf5292

Browse files
committed
clippy
1 parent b0bab11 commit daf5292

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

src/hooks.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ pub struct HookData {
99
pub pub_date: String,
1010
}
1111

12-
pub fn run_hook(hook: String, hookdata: Vec<HookData>) -> Result<(), std::io::Error> {
12+
pub fn run_hook(hook: &str, hookdata: Vec<HookData>) -> Result<(), std::io::Error> {
1313
for data in hookdata {
14-
Command::new(hook.clone())
14+
Command::new(hook)
1515
.env("TITLE", data.title)
1616
.env("TITLE_FMT", data.title_fmt)
1717
.env("AUTHOR", data.author)

src/junction.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ pub fn bundle_rss(state: &mut State, config: &Config) -> (Vec<HookData>, Channel
5050
state.guids.insert(guid.value.clone());
5151

5252
let data = HookData {
53-
title: item.title.as_ref().unwrap_or(&config.default_title).to_owned(),
53+
title: item.title.as_ref().unwrap_or(&config.default_title).clone(),
5454
title_fmt: item_title.clone(),
5555
author: item.author.clone().unwrap(),
5656
link: item.link.clone().unwrap_or_default(),

src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ fn main() -> ExitCode {
4040
let guids = load_guids().unwrap_or_default();
4141

4242
let state = State {
43-
rss: "".into(),
43+
rss: String::new(),
4444
guids,
4545
feeds: HashMap::new(),
4646
status: None,
@@ -66,7 +66,7 @@ fn main() -> ExitCode {
6666
} else { None };
6767

6868
if let Some(hook) = &config.hook {
69-
run_hook(hook.to_owned(), hookdata).unwrap();
69+
run_hook(hook, hookdata).unwrap();
7070
}
7171

7272
guard.status = status;
@@ -92,7 +92,7 @@ fn load_config() -> Result<Config, Box<dyn std::error::Error>> {
9292

9393
fn load_guids() -> Result<HashSet<String>, Box<dyn std::error::Error>> {
9494
let content = fs::read_to_string("guids")?;
95-
Ok(content.split("\n").filter(|x| x.len() > 0).map(str::to_owned).collect())
95+
Ok(content.split('\n').filter(|x| !x.is_empty()).map(str::to_owned).collect())
9696
}
9797

9898
fn save_guids(guids: &HashSet<String>) -> Result<(), Box<dyn std::error::Error>> {

src/server.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pub fn start(address: &str, thread_count: usize, state: Arc<Mutex<State>>) -> Ve
3232
continue
3333
}
3434
};
35-
let page = url.path().split("/").last().unwrap_or("");
35+
let page = url.path().split('/').last().unwrap_or("");
3636
let res = match page {
3737
"rss.xml" => {
3838
let guard = state.lock().unwrap();
@@ -55,4 +55,4 @@ pub fn start(address: &str, thread_count: usize, state: Arc<Mutex<State>>) -> Ve
5555
}
5656

5757
threads
58-
}
58+
}

0 commit comments

Comments
 (0)