diff --git a/src/actions/bitmagnet/client.rs b/src/actions/bitmagnet/client.rs index 0625145..cec2955 100644 --- a/src/actions/bitmagnet/client.rs +++ b/src/actions/bitmagnet/client.rs @@ -59,7 +59,7 @@ impl BitmagnetClient { } if let Some(name) = structured_magnet.dn { - json_body["name"] = json!(decode(&*name)?); + json_body["name"] = json!(decode(&name)?); } if let Some(id) = imdb_id { diff --git a/src/app.rs b/src/app.rs index 06027fb..0c0a9c7 100644 --- a/src/app.rs +++ b/src/app.rs @@ -44,11 +44,10 @@ impl App { /// Initialize actions based on configuration pub fn init_actions(&mut self) -> Result<()> { - if let Some(action) = init_action(&mut &self.config.bitmagnet, BitmagnetAction::new)? { + if let Some(action) = init_action(&self.config.bitmagnet, BitmagnetAction::new)? { self.actions.push(action); } - if let Some(action) = init_action(&mut &self.config.transmission, TransmissionAction::new)? - { + if let Some(action) = init_action(&self.config.transmission, TransmissionAction::new)? { self.actions.push(action); } @@ -67,7 +66,7 @@ impl App { /// Fetch posts from Reddit pub async fn fetch_posts(&self, post_count: u32) -> Result> { let mut unique_usernames = HashSet::new(); - for (_, source_config) in &self.config.sources { + for source_config in self.config.sources.values() { unique_usernames.insert(source_config.username.clone()); } diff --git a/src/config.rs b/src/config.rs index 53bec51..7bda111 100644 --- a/src/config.rs +++ b/src/config.rs @@ -67,7 +67,7 @@ pub fn load_config(args: &Args) -> Result { .wrap_err_with(|| "Invalid configuration or insufficient command line arguments")?; if conf.sources.is_empty() { - return Err(eyre!("No sources found in configuration. Please add at least one source to your configuration file.").into()); + return Err(eyre!("No sources found in configuration. Please add at least one source to your configuration file.")); } Ok(conf) diff --git a/src/report.rs b/src/report.rs index 5d69163..e62e077 100644 --- a/src/report.rs +++ b/src/report.rs @@ -36,7 +36,7 @@ pub fn generate_report( ) -> String { let mut report = String::new(); - report.push_str("\n"); + report.push('\n'); report.push_str(&format!( "{} {} {}\n", SPARKLES, @@ -53,7 +53,7 @@ pub fn generate_report( .bold() .green(), )); - report.push_str("\n"); + report.push('\n'); for (action_name, processed_magnets) in action_results { let success_count = processed_magnets.success.len(); @@ -61,11 +61,11 @@ pub fn generate_report( let total_count = success_count + failed_count; // Section header for each action - report.push_str("\n"); + report.push('\n'); report.push_str(&format!( "{} {} {}\n", ROCKET, - conditional_style(&format!("{}", action_name), use_colors) + conditional_style(action_name, use_colors) .bold() .underlined() .cyan(), @@ -77,7 +77,7 @@ pub fn generate_report( )); if failed_count == 0 && success_count == 0 { - report.push_str("\n"); + report.push('\n'); continue; } @@ -103,7 +103,7 @@ pub fn generate_report( .green() )); } - report.push_str("\n"); + report.push('\n'); // List successful magnets if success_count > 0 { @@ -119,7 +119,7 @@ pub fn generate_report( conditional_style(&magnet.title, use_colors).italic() )); } - report.push_str("\n"); + report.push('\n'); } // List failed magnets @@ -136,7 +136,7 @@ pub fn generate_report( conditional_style(&magnet.title, use_colors).italic() )); } - report.push_str("\n"); + report.push('\n'); } }