From 779064034a3a0f539d6afc95732f9578c11c2c13 Mon Sep 17 00:00:00 2001 From: SinTan1729 Date: Tue, 23 May 2023 17:50:40 -0500 Subject: [PATCH] change: More consistency improvements --- src/functions.rs | 4 ++-- src/structs.rs | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/functions.rs b/src/functions.rs index 7948720..9fa53c5 100644 --- a/src/functions.rs +++ b/src/functions.rs @@ -32,8 +32,8 @@ pub async fn process_file( let mut parent = String::new(); if let Some(parts) = filename.rsplit_once('/') { { - parent = parts.0.to_string(); - file_base = parts.1.to_string(); + parent = String::from(parts.0); + file_base = String::from(parts.1); } } diff --git a/src/structs.rs b/src/structs.rs index 267915d..64eda67 100644 --- a/src/structs.rs +++ b/src/structs.rs @@ -19,7 +19,7 @@ impl MovieEntry { director: String::from("N/A"), year: match movie.inner.release_date { Some(date) => date.format("%Y").to_string(), - _ => "N/A".to_string(), + _ => String::from("N/A"), }, language: get_long_lang(movie.inner.original_language.as_str()), } @@ -34,7 +34,7 @@ impl MovieEntry { title.truncate(159); format = format.replace("{title}", title.as_str()); - if self.year.as_str() != "N/A" { + if self.year != "N/A" { format = format.replace("{year}", self.year.as_str()); } else { format = format.replace("{year}", ""); @@ -88,7 +88,7 @@ impl Language { let mut list = Vec::new(); for lang in ["en", "hi", "bn", "fr", "ja", "de", "sp", "none"] { list.push(Language { - short: lang.to_string(), + short: String::from(lang), long: get_long_lang(lang), }); } @@ -116,5 +116,5 @@ pub fn get_long_lang(short: &str) -> String { "none" => "None", other => other, }; - long.to_string() + String::from(long) }