change: Do not dereference str when possible

This commit is contained in:
Sayantan Santra 2023-05-23 18:01:13 -05:00
parent 779064034a
commit 5e5ba7ea0a
Signed by: SinTan1729
GPG Key ID: EB3E68BFBA25C85F
2 changed files with 5 additions and 5 deletions

View File

@ -146,7 +146,7 @@ pub async fn process_file(
};
// Create the new name
new_name_base = choice.rename_format(pattern.to_string());
new_name_base = choice.rename_format(String::from(pattern));
} else {
println!(" Using previous choice for related files...");
}
@ -178,7 +178,7 @@ pub async fn process_file(
new_name_with_ext = format!("{new_name_with_ext}.{extension}");
}
let mut new_name = new_name_with_ext.clone();
if parent != *"" {
if !parent.is_empty() {
new_name = format!("{parent}/{new_name}");
}

View File

@ -16,8 +16,8 @@ async fn main() {
let (entries, settings) = process_args(args);
// Try to read config file, or display error
let mut config_file = env::var("XDG_CONFIG_HOME").unwrap_or("$HOME".to_string());
if config_file == *"$HOME" {
let mut config_file = env::var("XDG_CONFIG_HOME").unwrap_or(String::from("$HOME"));
if config_file == "$HOME" {
config_file = env::var("$HOME").unwrap();
config_file.push_str("/.config");
}
@ -38,7 +38,7 @@ async fn main() {
}
// Create TMDb object for API calls
let tmdb = Client::new(api_key.to_string());
let tmdb = Client::new(String::from(api_key));
// Iterate over entries
for entry in entries {