Skip to content

Commit 5485589

Browse files
committed
refactor: remove unneeded code
1 parent 93d1b64 commit 5485589

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

src/console/commands/import_tracker_statistics.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,14 @@ use crate::tracker::statistics_importer::StatisticsImporter;
3535

3636
const NUMBER_OF_ARGUMENTS: usize = 0;
3737

38-
#[derive(Debug)]
39-
pub struct Arguments {}
40-
4138
#[derive(Debug, Display, PartialEq, Error)]
4239
#[allow(dead_code)]
4340
pub enum ImportError {
4441
#[display(fmt = "internal server error")]
4542
WrongNumberOfArgumentsError,
4643
}
4744

48-
fn parse_args() -> Result<Arguments, ImportError> {
45+
fn parse_args() -> Result<(), ImportError> {
4946
let args: Vec<String> = env::args().skip(1).collect();
5047

5148
if args.len() != NUMBER_OF_ARGUMENTS {
@@ -59,7 +56,7 @@ fn parse_args() -> Result<Arguments, ImportError> {
5956
return Err(ImportError::WrongNumberOfArgumentsError);
6057
}
6158

62-
Ok(Arguments {})
59+
Ok(())
6360
}
6461

6562
fn print_usage() {
@@ -74,15 +71,16 @@ fn print_usage() {
7471
}
7572

7673
pub async fn run_importer() {
77-
import(&parse_args().expect("unable to parse command arguments")).await;
74+
parse_args().expect("unable to parse command arguments");
75+
import().await;
7876
}
7977

8078
/// Import Command Arguments
8179
///
8280
/// # Panics
8381
///
8482
/// Panics if `Configuration::load_from_file` has any error.
85-
pub async fn import(_args: &Arguments) {
83+
pub async fn import() {
8684
println!("Importing statistics from linked tracker ...");
8785

8886
let configuration = init_configuration().await;
@@ -110,5 +108,5 @@ pub async fn import(_args: &Arguments) {
110108
tracker_statistics_importer
111109
.import_all_torrents_statistics()
112110
.await
113-
.expect("variable `tracker_service` is unable to `update_torrents`");
111+
.expect("should import all torrents statistics");
114112
}

src/tracker/statistics_importer.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,11 @@ impl StatisticsImporter {
5050
// ```
5151

5252
if let Some(err) = ret.err() {
53-
error!(
53+
let message = format!(
5454
"Error updating torrent tracker stats for torrent with id {}: {:?}",
5555
torrent.torrent_id, err
5656
);
57+
error!("{}", message);
5758
}
5859
}
5960

0 commit comments

Comments
 (0)