cargo clippy
This commit is contained in:
31
src/main.rs
31
src/main.rs
@ -4,7 +4,6 @@ use std::{
|
||||
fs::{self, File},
|
||||
io::{self, BufRead, BufReader, Write},
|
||||
};
|
||||
use urlencoding;
|
||||
|
||||
fn show_usage() {
|
||||
println!("Available options:");
|
||||
@ -51,7 +50,7 @@ fn run_as_cli() -> i32 {
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
result
|
||||
}
|
||||
|
||||
fn run_with_input(arguments: Vec<String>) -> i32 {
|
||||
@ -80,7 +79,7 @@ fn run_with_input(arguments: Vec<String>) -> i32 {
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
result
|
||||
}
|
||||
|
||||
fn generate_file(client: &mut postgres::Client, website: Option<String>) -> i32 {
|
||||
@ -99,8 +98,8 @@ fn generate_file(client: &mut postgres::Client, website: Option<String>) -> i32
|
||||
.query_one("SELECT website_exists($1);", &[&website_name])
|
||||
.unwrap();
|
||||
|
||||
let result: bool = output.get(0);
|
||||
if result == false {
|
||||
let found: bool = output.get(0);
|
||||
if !found {
|
||||
eprintln!("Invalid website_name");
|
||||
return 1;
|
||||
}
|
||||
@ -126,7 +125,7 @@ fn generate_file(client: &mut postgres::Client, website: Option<String>) -> i32
|
||||
writeln!(file, "{} # {}", url, folder_path).unwrap();
|
||||
}
|
||||
|
||||
return 0;
|
||||
0
|
||||
}
|
||||
|
||||
fn convert_folders(client: &mut postgres::Client, path: Option<String>) -> i32 {
|
||||
@ -174,7 +173,7 @@ fn convert_folders(client: &mut postgres::Client, path: Option<String>) -> i32 {
|
||||
writeln!(log_file, "Converted {} => {}", old_path, new_path).unwrap();
|
||||
}
|
||||
|
||||
return 0;
|
||||
0
|
||||
}
|
||||
|
||||
fn import_file(client: &mut postgres::Client, file: Option<String>) -> i32 {
|
||||
@ -224,7 +223,7 @@ fn import_file(client: &mut postgres::Client, file: Option<String>) -> i32 {
|
||||
};
|
||||
}
|
||||
|
||||
return 0;
|
||||
0
|
||||
}
|
||||
|
||||
fn add_url(client: &mut postgres::Client, uri: Option<String>) -> i32 {
|
||||
@ -253,7 +252,7 @@ fn add_url(client: &mut postgres::Client, uri: Option<String>) -> i32 {
|
||||
|
||||
println!("{}", something);
|
||||
|
||||
return 0;
|
||||
0
|
||||
}
|
||||
|
||||
fn add_artist_with_custom_name(
|
||||
@ -297,22 +296,20 @@ fn add_artist_with_custom_name(
|
||||
|
||||
println!("{}", something);
|
||||
|
||||
return 0;
|
||||
0
|
||||
}
|
||||
|
||||
fn main() -> Result<(), i32> {
|
||||
let args: Vec<String> = args().collect();
|
||||
let result: i32;
|
||||
|
||||
if args.len() == 1 {
|
||||
result = run_as_cli();
|
||||
let result = if args.len() == 1 {
|
||||
run_as_cli()
|
||||
} else {
|
||||
result = run_with_input(args);
|
||||
}
|
||||
run_with_input(args)
|
||||
};
|
||||
|
||||
if result != 0 {
|
||||
return Err(result);
|
||||
}
|
||||
|
||||
return Ok(());
|
||||
Ok(())
|
||||
}
|
||||
|
Reference in New Issue
Block a user