Skip to content

Commit eeab0bd

Browse files
committed
chore: fmt + clippy
1 parent 06baa22 commit eeab0bd

File tree

2 files changed

+23
-18
lines changed

2 files changed

+23
-18
lines changed

src/database/updater.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use anyhow::{Context, Result, anyhow};
22
use chrono::Utc;
33
use log::{info, warn};
4-
use reqwest::blocking::Client;
54
use reqwest::Url;
5+
use reqwest::blocking::Client;
66
use serde::{Deserialize, Serialize};
77
use std::time::Duration;
88

@@ -125,7 +125,11 @@ impl DatabaseUpdater {
125125
/// Update the database to the latest version
126126
pub fn update_database(&mut self, force: bool) -> Result<UpdateSummary> {
127127
// Check if update is needed unless forced
128-
let update_needed = if !force { self.check_for_updates()? } else { true };
128+
let update_needed = if !force {
129+
self.check_for_updates()?
130+
} else {
131+
true
132+
};
129133

130134
if !update_needed && !force {
131135
return Err(anyhow!(

src/main.rs

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ enum Commands {
5858

5959
/// Display OS-specific scheduling instructions
6060
ScheduleUpdates {
61-
///Time between updates
62-
#[arg(short,long, default_value_t = 24)]
63-
hours: u64
64-
},
61+
///Time between updates
62+
#[arg(short, long, default_value_t = 24)]
63+
hours: u64,
64+
},
6565

6666
/// Remove a quarantined malware file
6767
Remove {
@@ -80,7 +80,7 @@ enum Commands {
8080
#[arg(short, long, value_hint = clap::ValueHint::AnyPath)]
8181
path: PathBuf,
8282
///Malware name
83-
#[arg(short='n', long)]
83+
#[arg(short = 'n', long)]
8484
name: Option<String>,
8585
},
8686

@@ -100,11 +100,11 @@ enum Commands {
100100
#[arg(short, long, value_hint = clap::ValueHint::AnyPath)]
101101
path: PathBuf,
102102

103-
/// Skip file removal confirmation
103+
/// Skip file removal confirmation
104104
#[arg(short, long)]
105105
force: bool,
106106
},
107-
///Hash a file
107+
///Hash a file
108108
Hash {
109109
/// Path to file or directory
110110
#[arg(short, long)]
@@ -119,14 +119,14 @@ fn main() -> ExitCode {
119119
// Handle command errors
120120
if let Err(err) = run() {
121121
error!("Error: {err}");
122-
return ExitCode::FAILURE;
122+
ExitCode::FAILURE
123123
} else {
124-
ExitCode::SUCCESS}
124+
ExitCode::SUCCESS
125+
}
125126
}
126127

127-
128128
fn run() -> Result<(), anyhow::Error> {
129-
// Parse command line arguments
129+
// Parse command line arguments
130130
let cli = Cli::parse();
131131

132132
// Initialize logger with appropriate verbosity
@@ -135,7 +135,7 @@ fn run() -> Result<(), anyhow::Error> {
135135
});
136136

137137
// Execute the selected command
138-
let result = match cli.command {
138+
match cli.command {
139139
Commands::Scan { path, deep } => {
140140
info!("Scanning path: {}, deep scan: {}", path.display(), deep);
141141
cli::scan::handle_scan_command(path, deep)
@@ -152,7 +152,7 @@ fn run() -> Result<(), anyhow::Error> {
152152
info!("Removing malware with ID: {id}");
153153
cli::remove::handle_remove_command(&id, force)
154154
}
155-
Commands::ScheduleUpdates {hours} => cli::update::handle_schedule_command(hours),
155+
Commands::ScheduleUpdates { hours } => cli::update::handle_schedule_command(hours),
156156
Commands::QuarantineFile { path, name } => {
157157
info!("Quarantining malware with Path: {}", path.display());
158158
cli::quarantine::handle_quarantine_file_command(path, name)
@@ -162,11 +162,12 @@ fn run() -> Result<(), anyhow::Error> {
162162
cli::quarantine::handle_list_quarantine_command()
163163
}
164164
Commands::Restore { id } => cli::quarantine::handle_restore_command(&id),
165-
Commands::RemoveFile { path, force } => cli::remove::handle_remove_file_command(path, force),
165+
Commands::RemoveFile { path, force } => {
166+
cli::remove::handle_remove_file_command(path, force)
167+
}
166168
Commands::Hash { path, json } => {
167169
info!("Hashing file with name {path}");
168170
cli::hash::handle_hash_command(&path, json)
169171
}
170-
};
171-
return result;
172+
}
172173
}

0 commit comments

Comments
 (0)