Merge branch 'clippy' into 'main'
Make clippy happy See merge request kernald/reddit-magnet!28
This commit is contained in:
commit
a0ffa68948
4 changed files with 13 additions and 14 deletions
|
|
@ -59,7 +59,7 @@ impl BitmagnetClient {
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(name) = structured_magnet.dn {
|
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 {
|
if let Some(id) = imdb_id {
|
||||||
|
|
|
||||||
|
|
@ -44,11 +44,10 @@ impl App {
|
||||||
|
|
||||||
/// Initialize actions based on configuration
|
/// Initialize actions based on configuration
|
||||||
pub fn init_actions(&mut self) -> Result<()> {
|
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);
|
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);
|
self.actions.push(action);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -67,7 +66,7 @@ impl App {
|
||||||
/// Fetch posts from Reddit
|
/// Fetch posts from Reddit
|
||||||
pub async fn fetch_posts(&self, post_count: u32) -> Result<MultiMap<String, RedditPost>> {
|
pub async fn fetch_posts(&self, post_count: u32) -> Result<MultiMap<String, RedditPost>> {
|
||||||
let mut unique_usernames = HashSet::new();
|
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());
|
unique_usernames.insert(source_config.username.clone());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ pub fn load_config(args: &Args) -> Result<Config> {
|
||||||
.wrap_err_with(|| "Invalid configuration or insufficient command line arguments")?;
|
.wrap_err_with(|| "Invalid configuration or insufficient command line arguments")?;
|
||||||
|
|
||||||
if conf.sources.is_empty() {
|
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)
|
Ok(conf)
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ pub fn generate_report(
|
||||||
) -> String {
|
) -> String {
|
||||||
let mut report = String::new();
|
let mut report = String::new();
|
||||||
|
|
||||||
report.push_str("\n");
|
report.push('\n');
|
||||||
report.push_str(&format!(
|
report.push_str(&format!(
|
||||||
"{} {} {}\n",
|
"{} {} {}\n",
|
||||||
SPARKLES,
|
SPARKLES,
|
||||||
|
|
@ -53,7 +53,7 @@ pub fn generate_report(
|
||||||
.bold()
|
.bold()
|
||||||
.green(),
|
.green(),
|
||||||
));
|
));
|
||||||
report.push_str("\n");
|
report.push('\n');
|
||||||
|
|
||||||
for (action_name, processed_magnets) in action_results {
|
for (action_name, processed_magnets) in action_results {
|
||||||
let success_count = processed_magnets.success.len();
|
let success_count = processed_magnets.success.len();
|
||||||
|
|
@ -61,11 +61,11 @@ pub fn generate_report(
|
||||||
let total_count = success_count + failed_count;
|
let total_count = success_count + failed_count;
|
||||||
|
|
||||||
// Section header for each action
|
// Section header for each action
|
||||||
report.push_str("\n");
|
report.push('\n');
|
||||||
report.push_str(&format!(
|
report.push_str(&format!(
|
||||||
"{} {} {}\n",
|
"{} {} {}\n",
|
||||||
ROCKET,
|
ROCKET,
|
||||||
conditional_style(&format!("{}", action_name), use_colors)
|
conditional_style(action_name, use_colors)
|
||||||
.bold()
|
.bold()
|
||||||
.underlined()
|
.underlined()
|
||||||
.cyan(),
|
.cyan(),
|
||||||
|
|
@ -77,7 +77,7 @@ pub fn generate_report(
|
||||||
));
|
));
|
||||||
|
|
||||||
if failed_count == 0 && success_count == 0 {
|
if failed_count == 0 && success_count == 0 {
|
||||||
report.push_str("\n");
|
report.push('\n');
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -103,7 +103,7 @@ pub fn generate_report(
|
||||||
.green()
|
.green()
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
report.push_str("\n");
|
report.push('\n');
|
||||||
|
|
||||||
// List successful magnets
|
// List successful magnets
|
||||||
if success_count > 0 {
|
if success_count > 0 {
|
||||||
|
|
@ -119,7 +119,7 @@ pub fn generate_report(
|
||||||
conditional_style(&magnet.title, use_colors).italic()
|
conditional_style(&magnet.title, use_colors).italic()
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
report.push_str("\n");
|
report.push('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
// List failed magnets
|
// List failed magnets
|
||||||
|
|
@ -136,7 +136,7 @@ pub fn generate_report(
|
||||||
conditional_style(&magnet.title, use_colors).italic()
|
conditional_style(&magnet.title, use_colors).italic()
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
report.push_str("\n");
|
report.push('\n');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue