From eedad385570a3f0fc651528e12433fd55e63aba9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Tue, 20 Dec 2022 12:25:48 +0100 Subject: [PATCH] Nightly Clippy --- czkawka_cli/src/main.rs | 2 +- czkawka_core/src/bad_extensions.rs | 6 +++--- czkawka_core/src/big_file.rs | 4 ++-- czkawka_core/src/broken_files.rs | 4 ++-- czkawka_core/src/common.rs | 8 ++++---- czkawka_core/src/common_extensions.rs | 6 +++--- czkawka_core/src/duplicate.rs | 10 +++++----- czkawka_core/src/empty_files.rs | 4 ++-- czkawka_core/src/empty_folder.rs | 4 ++-- czkawka_core/src/invalid_symlinks.rs | 4 ++-- czkawka_core/src/same_music.rs | 6 +++--- czkawka_core/src/similar_images.rs | 16 ++++++++-------- czkawka_core/src/similar_videos.rs | 6 +++--- czkawka_core/src/temporary.rs | 4 ++-- .../src/connect_things/connect_about_buttons.rs | 8 ++++---- .../src/connect_things/connect_button_compare.rs | 10 +++++----- .../connect_things/connect_change_language.rs | 2 +- .../src/connect_things/connect_settings.rs | 4 ++-- czkawka_gui/src/help_functions.rs | 4 ++-- czkawka_gui/src/opening_selecting_records.rs | 8 ++++---- czkawka_gui/src/saving_loading.rs | 16 ++++++++-------- 21 files changed, 68 insertions(+), 68 deletions(-) diff --git a/czkawka_cli/src/main.rs b/czkawka_cli/src/main.rs index 7fa4faf..a98ba6d 100644 --- a/czkawka_cli/src/main.rs +++ b/czkawka_cli/src/main.rs @@ -36,7 +36,7 @@ fn main() { set_default_number_of_threads(); println!("Set thread number to {}", get_number_of_threads()); #[cfg(debug_assertions)] - println!("{:?}", command); + println!("{command:?}"); match command { Commands::Duplicates(duplicates_args) => duplicates(duplicates_args), diff --git a/czkawka_core/src/bad_extensions.rs b/czkawka_core/src/bad_extensions.rs index a6bf750..564b638 100644 --- a/czkawka_core/src/bad_extensions.rs +++ b/czkawka_core/src/bad_extensions.rs @@ -424,7 +424,7 @@ impl BadExtensions { } } - let mut guessed_multiple_extensions = format!("({}) - ", proper_extension); + let mut guessed_multiple_extensions = format!("({proper_extension}) - "); for ext in &all_available_extensions { guessed_multiple_extensions.push_str(ext); guessed_multiple_extensions.push(','); @@ -523,7 +523,7 @@ impl SaveResults for BadExtensions { let file_handler = match File::create(&file_name) { Ok(t) => t, Err(e) => { - self.text_messages.errors.push(format!("Failed to create file {}, reason {}", file_name, e)); + self.text_messages.errors.push(format!("Failed to create file {file_name}, reason {e}")); return false; } }; @@ -534,7 +534,7 @@ impl SaveResults for BadExtensions { "Results of searching {:?} with excluded directories {:?} and excluded items {:?}", self.directories.included_directories, self.directories.excluded_directories, self.excluded_items.items ) { - self.text_messages.errors.push(format!("Failed to save results to file {}, reason {}", file_name, e)); + self.text_messages.errors.push(format!("Failed to save results to file {file_name}, reason {e}")); return false; } diff --git a/czkawka_core/src/big_file.rs b/czkawka_core/src/big_file.rs index e6fd3d5..166b717 100644 --- a/czkawka_core/src/big_file.rs +++ b/czkawka_core/src/big_file.rs @@ -449,7 +449,7 @@ impl SaveResults for BigFile { let file_handler = match File::create(&file_name) { Ok(t) => t, Err(e) => { - self.text_messages.errors.push(format!("Failed to create file {}, reason {}", file_name, e)); + self.text_messages.errors.push(format!("Failed to create file {file_name}, reason {e}")); return false; } }; @@ -460,7 +460,7 @@ impl SaveResults for BigFile { "Results of searching {:?} with excluded directories {:?} and excluded items {:?}", self.directories.included_directories, self.directories.excluded_directories, self.excluded_items.items ) { - self.text_messages.errors.push(format!("Failed to save results to file {}, reason {}", file_name, e)); + self.text_messages.errors.push(format!("Failed to save results to file {file_name}, reason {e}")); return false; } diff --git a/czkawka_core/src/broken_files.rs b/czkawka_core/src/broken_files.rs index 7e556f9..755285d 100644 --- a/czkawka_core/src/broken_files.rs +++ b/czkawka_core/src/broken_files.rs @@ -663,7 +663,7 @@ impl SaveResults for BrokenFiles { let file_handler = match File::create(&file_name) { Ok(t) => t, Err(e) => { - self.text_messages.errors.push(format!("Failed to create file {}, reason {}", file_name, e)); + self.text_messages.errors.push(format!("Failed to create file {file_name}, reason {e}")); return false; } }; @@ -674,7 +674,7 @@ impl SaveResults for BrokenFiles { "Results of searching {:?} with excluded directories {:?} and excluded items {:?}", self.directories.included_directories, self.directories.excluded_directories, self.excluded_items.items ) { - self.text_messages.errors.push(format!("Failed to save results to file {}, reason {}", file_name, e)); + self.text_messages.errors.push(format!("Failed to save results to file {file_name}, reason {e}")); return false; } diff --git a/czkawka_core/src/common.rs b/czkawka_core/src/common.rs index 15ce72a..a8f7fda 100644 --- a/czkawka_core/src/common.rs +++ b/czkawka_core/src/common.rs @@ -212,10 +212,10 @@ impl Common { path = Path::new(entry); if path.is_dir() { if let Err(e) = fs::remove_dir_all(entry) { - warnings.push(format!("Failed to remove folder {}, reason {}", entry, e)); + warnings.push(format!("Failed to remove folder {entry}, reason {e}")); } } else if let Err(e) = fs::remove_file(entry) { - warnings.push(format!("Failed to remove file {}, reason {}", entry, e)); + warnings.push(format!("Failed to remove file {entry}, reason {e}")); } } warnings @@ -225,10 +225,10 @@ impl Common { let mut warning: String = String::from(""); if path.is_dir() { if let Err(e) = fs::remove_dir_all(entry) { - warning = format!("Failed to remove folder {}, reason {}", entry, e) + warning = format!("Failed to remove folder {entry}, reason {e}") } } else if let Err(e) = fs::remove_file(entry) { - warning = format!("Failed to remove file {}, reason {}", entry, e) + warning = format!("Failed to remove file {entry}, reason {e}") } warning } diff --git a/czkawka_core/src/common_extensions.rs b/czkawka_core/src/common_extensions.rs index 62cf03e..ac885b4 100644 --- a/czkawka_core/src/common_extensions.rs +++ b/czkawka_core/src/common_extensions.rs @@ -31,18 +31,18 @@ impl Extensions { } if !extension.starts_with('.') { - extension = format!(".{}", extension); + extension = format!(".{extension}"); } if extension[1..].contains('.') { - text_messages.warnings.push(format!("{} is not valid extension because contains dot inside", extension)); + text_messages.warnings.push(format!("{extension} is not valid extension because contains dot inside")); continue; } if extension[1..].contains(' ') { text_messages .warnings - .push(format!("{} is not valid extension because contains empty space inside", extension)); + .push(format!("{extension} is not valid extension because contains empty space inside")); continue; } diff --git a/czkawka_core/src/duplicate.rs b/czkawka_core/src/duplicate.rs index 2ad78fe..3ce0e7a 100644 --- a/czkawka_core/src/duplicate.rs +++ b/czkawka_core/src/duplicate.rs @@ -1003,7 +1003,7 @@ impl SaveResults for DuplicateFinder { let file_handler = match File::create(&file_name) { Ok(t) => t, Err(e) => { - self.text_messages.errors.push(format!("Failed to create file {}, reason {}", file_name, e)); + self.text_messages.errors.push(format!("Failed to create file {file_name}, reason {e}")); return false; } }; @@ -1014,7 +1014,7 @@ impl SaveResults for DuplicateFinder { "Results of searching {:?} with excluded directories {:?} and excluded items {:?}", self.directories.included_directories, self.directories.excluded_directories, self.excluded_items.items ) { - self.text_messages.errors.push(format!("Failed to save results to file {}, reason {}", file_name, e)); + self.text_messages.errors.push(format!("Failed to save results to file {file_name}, reason {e}")); return false; } match self.check_method { @@ -1117,7 +1117,7 @@ impl PrintResults for DuplicateFinder { number_of_files += i.1.len() as u64; number_of_groups += 1; } - println!("Found {} files in {} groups with same name(may have different content)", number_of_files, number_of_groups,); + println!("Found {number_of_files} files in {number_of_groups} groups with same name(may have different content)",); for (name, vector) in &self.files_with_identical_names { println!("Name - {} - {} files ", name, vector.len()); for j in vector { @@ -1282,7 +1282,7 @@ pub fn save_hashes_to_file(hashmap: &BTreeMap, text_messages: if file_entry.size >= minimal_cache_file_size { let string: String = format!("{}//{}//{}//{}", file_entry.path.display(), file_entry.size, file_entry.modified_date, file_entry.hash); - if let Err(e) = writeln!(writer, "{}", string) { + if let Err(e) = writeln!(writer, "{string}") { text_messages .warnings .push(format!("Failed to save some data to cache file {}, reason {}", cache_file.display(), e)); @@ -1411,7 +1411,7 @@ fn hash_calculation(buffer: &mut [u8], file_entry: &FileEntry, hash_type: &HashT fn get_file_hash_name(type_of_hash: &HashType, is_prehash: bool) -> String { let prehash_str = if is_prehash { "_prehash" } else { "" }; - format!("cache_duplicates_{:?}{}.txt", type_of_hash, prehash_str) + format!("cache_duplicates_{type_of_hash:?}{prehash_str}.txt") } impl MyHasher for blake3::Hasher { diff --git a/czkawka_core/src/empty_files.rs b/czkawka_core/src/empty_files.rs index a775ffa..1f48345 100644 --- a/czkawka_core/src/empty_files.rs +++ b/czkawka_core/src/empty_files.rs @@ -222,7 +222,7 @@ impl SaveResults for EmptyFiles { let file_handler = match File::create(&file_name) { Ok(t) => t, Err(e) => { - self.text_messages.errors.push(format!("Failed to create file {}, reason {}", file_name, e)); + self.text_messages.errors.push(format!("Failed to create file {file_name}, reason {e}")); return false; } }; @@ -233,7 +233,7 @@ impl SaveResults for EmptyFiles { "Results of searching {:?} with excluded directories {:?} and excluded items {:?}", self.directories.included_directories, self.directories.excluded_directories, self.excluded_items.items ) { - self.text_messages.errors.push(format!("Failed to save results to file {}, reason {}", file_name, e)); + self.text_messages.errors.push(format!("Failed to save results to file {file_name}, reason {e}")); return false; } diff --git a/czkawka_core/src/empty_folder.rs b/czkawka_core/src/empty_folder.rs index 2e73f12..990d29c 100644 --- a/czkawka_core/src/empty_folder.rs +++ b/czkawka_core/src/empty_folder.rs @@ -213,7 +213,7 @@ impl SaveResults for EmptyFolder { let file_handler = match File::create(&file_name) { Ok(t) => t, Err(e) => { - self.text_messages.errors.push(format!("Failed to create file {}, reason {}", file_name, e)); + self.text_messages.errors.push(format!("Failed to create file {file_name}, reason {e}")); return false; } }; @@ -224,7 +224,7 @@ impl SaveResults for EmptyFolder { "Results of searching {:?} with excluded directories {:?}", self.directories.included_directories, self.directories.excluded_directories ) { - self.text_messages.errors.push(format!("Failed to save results to file {}, reason {}", file_name, e)); + self.text_messages.errors.push(format!("Failed to save results to file {file_name}, reason {e}")); return false; } diff --git a/czkawka_core/src/invalid_symlinks.rs b/czkawka_core/src/invalid_symlinks.rs index a443374..5bc32ab 100644 --- a/czkawka_core/src/invalid_symlinks.rs +++ b/czkawka_core/src/invalid_symlinks.rs @@ -218,7 +218,7 @@ impl SaveResults for InvalidSymlinks { let file_handler = match File::create(&file_name) { Ok(t) => t, Err(e) => { - self.text_messages.errors.push(format!("Failed to create file {}, reason {}", file_name, e)); + self.text_messages.errors.push(format!("Failed to create file {file_name}, reason {e}")); return false; } }; @@ -229,7 +229,7 @@ impl SaveResults for InvalidSymlinks { "Results of searching {:?} with excluded directories {:?} and excluded items {:?}", self.directories.included_directories, self.directories.excluded_directories, self.excluded_items.items ) { - self.text_messages.errors.push(format!("Failed to save results to file {}, reason {}", file_name, e)); + self.text_messages.errors.push(format!("Failed to save results to file {file_name}, reason {e}")); return false; } diff --git a/czkawka_core/src/same_music.rs b/czkawka_core/src/same_music.rs index cd0dcd6..6fd2bc9 100644 --- a/czkawka_core/src/same_music.rs +++ b/czkawka_core/src/same_music.rs @@ -445,7 +445,7 @@ impl SameMusic { let minutes = length_number / 1000; let seconds = (length_number % 1000) * 6 / 100; if minutes != 0 || seconds != 0 { - length = format!("{}:{:02}", minutes, seconds); + length = format!("{minutes}:{seconds:02}"); } else if old_length_number > 0 { // That means, that audio have length smaller that second, but length is properly read length = "0:01".to_string(); @@ -897,7 +897,7 @@ impl SaveResults for SameMusic { let file_handler = match File::create(&file_name) { Ok(t) => t, Err(e) => { - self.text_messages.errors.push(format!("Failed to create file {}, reason {}", file_name, e)); + self.text_messages.errors.push(format!("Failed to create file {file_name}, reason {e}")); return false; } }; @@ -908,7 +908,7 @@ impl SaveResults for SameMusic { "Results of searching {:?} with excluded directories {:?} and excluded items {:?}", self.directories.included_directories, self.directories.excluded_directories, self.excluded_items.items ) { - self.text_messages.errors.push(format!("Failed to save results to file {}, reason {}", file_name, e)); + self.text_messages.errors.push(format!("Failed to save results to file {file_name}, reason {e}")); return false; } diff --git a/czkawka_core/src/similar_images.rs b/czkawka_core/src/similar_images.rs index 0ba12ac..dc03640 100644 --- a/czkawka_core/src/similar_images.rs +++ b/czkawka_core/src/similar_images.rs @@ -159,7 +159,7 @@ impl SimilarImages { self.hash_size = match hash_size { 8 | 16 | 32 | 64 => hash_size, e => { - panic!("Invalid value of hash size {}", e); + panic!("Invalid value of hash size {e}"); } } } @@ -961,12 +961,12 @@ impl SimilarImages { let mut found = false; for (_hash, vec_file_entry) in collected_similar_images.iter() { if vec_file_entry.is_empty() { - println!("Empty Element {:?}", vec_file_entry); + println!("Empty Element {vec_file_entry:?}"); found = true; continue; } if vec_file_entry.len() == 1 { - println!("Single Element {:?}", vec_file_entry); + println!("Single Element {vec_file_entry:?}"); found = true; continue; } @@ -974,7 +974,7 @@ impl SimilarImages { let st = file_entry.path.to_string_lossy().to_string(); if result_hashset.contains(&st) { found = true; - println!("Duplicated Element {}", st); + println!("Duplicated Element {st}"); } else { result_hashset.insert(st); } @@ -1161,7 +1161,7 @@ impl SaveResults for SimilarImages { let file_handler = match File::create(&file_name) { Ok(t) => t, Err(e) => { - self.text_messages.errors.push(format!("Failed to create file {}, reason {}", file_name, e)); + self.text_messages.errors.push(format!("Failed to create file {file_name}, reason {e}")); return false; } }; @@ -1172,7 +1172,7 @@ impl SaveResults for SimilarImages { "Results of searching {:?} with excluded directories {:?} and excluded items {:?}", self.directories.included_directories, self.directories.excluded_directories, self.excluded_items.items ) { - self.text_messages.errors.push(format!("Failed to save results to file {}, reason {}", file_name, e)); + self.text_messages.errors.push(format!("Failed to save results to file {file_name}, reason {e}")); return false; } @@ -1471,7 +1471,7 @@ fn debug_check_for_duplicated_things( for i in all_hashed_images.get(*hash).unwrap() { let name = i.path.to_string_lossy().to_string(); if hashmap_names.contains(&name) { - println!("------1--NAME--{} {:?}", numm, name); + println!("------1--NAME--{numm} {name:?}"); found_broken_thing = true; } hashmap_names.insert(name); @@ -1488,7 +1488,7 @@ fn debug_check_for_duplicated_things( for i in all_hashed_images.get(*hash).unwrap() { let name = i.path.to_string_lossy().to_string(); if hashmap_names.contains(&name) { - println!("------2--NAME--{} {:?}", numm, name); + println!("------2--NAME--{numm} {name:?}"); found_broken_thing = true; } hashmap_names.insert(name); diff --git a/czkawka_core/src/similar_videos.rs b/czkawka_core/src/similar_videos.rs index 5878f95..0eefcb6 100644 --- a/czkawka_core/src/similar_videos.rs +++ b/czkawka_core/src/similar_videos.rs @@ -519,7 +519,7 @@ impl SimilarVideos { Ok(t) => t, Err(e) => { return { - file_entry.error = format!("Failed to hash file, reason {}", e); + file_entry.error = format!("Failed to hash file, reason {e}"); Some(file_entry) }; } @@ -694,7 +694,7 @@ impl SaveResults for SimilarVideos { let file_handler = match File::create(&file_name) { Ok(t) => t, Err(e) => { - self.text_messages.errors.push(format!("Failed to create file {}, reason {}", file_name, e)); + self.text_messages.errors.push(format!("Failed to create file {file_name}, reason {e}")); return false; } }; @@ -705,7 +705,7 @@ impl SaveResults for SimilarVideos { "Results of searching {:?} with excluded directories {:?} and excluded items {:?}", self.directories.included_directories, self.directories.excluded_directories, self.excluded_items.items ) { - self.text_messages.errors.push(format!("Failed to save results to file {}, reason {}", file_name, e)); + self.text_messages.errors.push(format!("Failed to save results to file {file_name}, reason {e}")); return false; } diff --git a/czkawka_core/src/temporary.rs b/czkawka_core/src/temporary.rs index b981a30..f30a219 100644 --- a/czkawka_core/src/temporary.rs +++ b/czkawka_core/src/temporary.rs @@ -396,7 +396,7 @@ impl SaveResults for Temporary { let file_handler = match File::create(&file_name) { Ok(t) => t, Err(e) => { - self.text_messages.errors.push(format!("Failed to create file {}, reason {}", file_name, e)); + self.text_messages.errors.push(format!("Failed to create file {file_name}, reason {e}")); return false; } }; @@ -407,7 +407,7 @@ impl SaveResults for Temporary { "Results of searching {:?} with excluded directories {:?} and excluded items {:?}", self.directories.included_directories, self.directories.excluded_directories, self.excluded_items.items ) { - self.text_messages.errors.push(format!("Failed to save results to file {}, reason {}", file_name, e)); + self.text_messages.errors.push(format!("Failed to save results to file {file_name}, reason {e}")); return false; } diff --git a/czkawka_gui/src/connect_things/connect_about_buttons.rs b/czkawka_gui/src/connect_things/connect_about_buttons.rs index fdc1722..ddbf7c3 100644 --- a/czkawka_gui/src/connect_things/connect_about_buttons.rs +++ b/czkawka_gui/src/connect_things/connect_about_buttons.rs @@ -11,28 +11,28 @@ pub fn connect_about_buttons(gui_data: &GuiData) { let button_donation = gui_data.about.button_donation.clone(); button_donation.connect_clicked(move |_| { if let Err(e) = open::that(SPONSOR_SITE) { - println!("Failed to open sponsor site: {}, reason {}", SPONSOR_SITE, e) + println!("Failed to open sponsor site: {SPONSOR_SITE}, reason {e}") }; }); let button_instruction = gui_data.about.button_instruction.clone(); button_instruction.connect_clicked(move |_| { if let Err(e) = open::that(INSTRUCTION_SITE) { - println!("Failed to open instruction site: {}, reason {}", INSTRUCTION_SITE, e) + println!("Failed to open instruction site: {INSTRUCTION_SITE}, reason {e}") }; }); let button_repository = gui_data.about.button_repository.clone(); button_repository.connect_clicked(move |_| { if let Err(e) = open::that(REPOSITORY_SITE) { - println!("Failed to open repository site: {}, reason {}", REPOSITORY_SITE, e) + println!("Failed to open repository site: {REPOSITORY_SITE}, reason {e}") }; }); let button_translation = gui_data.about.button_translation.clone(); button_translation.connect_clicked(move |_| { if let Err(e) = open::that(TRANSLATION_SITE) { - println!("Failed to open repository site: {}, reason {}", TRANSLATION_SITE, e) + println!("Failed to open repository site: {TRANSLATION_SITE}, reason {e}") }; }); } diff --git a/czkawka_gui/src/connect_things/connect_button_compare.rs b/czkawka_gui/src/connect_things/connect_button_compare.rs index 876c500..121b6bb 100644 --- a/czkawka_gui/src/connect_things/connect_button_compare.rs +++ b/czkawka_gui/src/connect_things/connect_button_compare.rs @@ -389,12 +389,12 @@ fn generate_cache_for_results(vector_with_path: Vec<(String, String, TreePath)>) pixbuf = t; } Err(e) => { - println!("Failed to open image {}, reason {}", full_path, e); + println!("Failed to open image {full_path}, reason {e}"); } }; } Err(e) => { - println!("Failed to open image {}, reason {}", full_path, e); + println!("Failed to open image {full_path}, reason {e}"); } }; break 'czystka; @@ -407,7 +407,7 @@ fn generate_cache_for_results(vector_with_path: Vec<(String, String, TreePath)>) pixbuf = t; } Err(e) => { - println!("Failed to open image {}, reason {}", full_path, e); + println!("Failed to open image {full_path}, reason {e}"); } }; } @@ -416,14 +416,14 @@ fn generate_cache_for_results(vector_with_path: Vec<(String, String, TreePath)>) loop { let pixbuf_big = match resize_pixbuf_dimension(pixbuf, (BIG_PREVIEW_SIZE, BIG_PREVIEW_SIZE), InterpType::Nearest) { None => { - println!("Failed to resize image {}.", full_path); + println!("Failed to resize image {full_path}."); break; } Some(pixbuf) => pixbuf, }; let pixbuf_small = match resize_pixbuf_dimension(pixbuf_big.clone(), (SMALL_PREVIEW_SIZE, SMALL_PREVIEW_SIZE), InterpType::Nearest) { None => { - println!("Failed to resize image {}.", full_path); + println!("Failed to resize image {full_path}."); break; } Some(pixbuf) => pixbuf, diff --git a/czkawka_gui/src/connect_things/connect_change_language.rs b/czkawka_gui/src/connect_things/connect_change_language.rs index 08a2d40..0e83e41 100644 --- a/czkawka_gui/src/connect_things/connect_change_language.rs +++ b/czkawka_gui/src/connect_things/connect_change_language.rs @@ -28,7 +28,7 @@ fn change_language(gui_data: &GuiData) { let lang_identifier = vec![LanguageIdentifier::from_bytes(lang_short.as_bytes()).unwrap()]; for (lib, localizer) in localizers { if let Err(error) = localizer.select(&lang_identifier) { - eprintln!("Error while loadings languages for {} {:?}", lib, error); + eprintln!("Error while loadings languages for {lib} {error:?}"); } } gui_data.update_language(); diff --git a/czkawka_gui/src/connect_things/connect_settings.rs b/czkawka_gui/src/connect_things/connect_settings.rs index 77b9af2..5a95c7b 100644 --- a/czkawka_gui/src/connect_things/connect_settings.rs +++ b/czkawka_gui/src/connect_things/connect_settings.rs @@ -84,7 +84,7 @@ pub fn connect_settings(gui_data: &GuiData) { let cache_dir = proj_dirs.cache_dir(); if let Err(e) = open::that(cache_dir) { - println!("Failed to open config folder {:?}, reason {}", cache_dir, e); + println!("Failed to open config folder {cache_dir:?}, reason {e}"); }; } }); @@ -97,7 +97,7 @@ pub fn connect_settings(gui_data: &GuiData) { let config_dir = proj_dirs.config_dir(); if let Err(e) = open::that(config_dir) { - println!("Failed to open config folder {:?}, reason {}", config_dir, e); + println!("Failed to open config folder {config_dir:?}, reason {e}"); }; } }); diff --git a/czkawka_gui/src/help_functions.rs b/czkawka_gui/src/help_functions.rs index 5032ed9..4244c1a 100644 --- a/czkawka_gui/src/help_functions.rs +++ b/czkawka_gui/src/help_functions.rs @@ -303,7 +303,7 @@ pub fn add_text_to_text_view(text_view: &TextView, string_to_append: &str) { if current_text.is_empty() { buffer.set_text(string_to_append); } else { - buffer.set_text(format!("{}\n{}", current_text, string_to_append).as_str()); + buffer.set_text(format!("{current_text}\n{string_to_append}").as_str()); } } @@ -669,7 +669,7 @@ pub fn debug_print_widget>(item: &P) { widgets_to_check.push((next_free_number, current_number, widget)); next_free_number += 1; } - println!("{}, {}, {:?} ", current_number, parent_number, widget); + println!("{current_number}, {parent_number}, {widget:?} "); } } diff --git a/czkawka_gui/src/opening_selecting_records.rs b/czkawka_gui/src/opening_selecting_records.rs index dbe7c42..012d047 100644 --- a/czkawka_gui/src/opening_selecting_records.rs +++ b/czkawka_gui/src/opening_selecting_records.rs @@ -12,7 +12,7 @@ pub fn opening_enter_function_ported_upper_directories(event_controller: >k4:: let tree_view = event_controller.widget().downcast::().unwrap(); #[cfg(debug_assertions)] { - println!("key_code {}", key_code); + println!("key_code {key_code}"); } match get_notebook_upper_enum_from_tree_view(&tree_view) { @@ -68,7 +68,7 @@ pub fn opening_enter_function_ported(event_controller: >k4::EventControllerKey let tree_view = event_controller.widget().downcast::().unwrap(); #[cfg(debug_assertions)] { - println!("key_code {}", key_code); + println!("key_code {key_code}"); } let nt_object = get_notebook_object_from_tree_view(&tree_view); @@ -132,7 +132,7 @@ fn common_open_function(tree_view: >k4::TreeView, column_name: i32, column_pat }; if let Err(e) = open::that(&end_path) { - println!("Failed to open file {}, reason {}", end_path, e); + println!("Failed to open file {end_path}, reason {e}"); }; } } @@ -190,7 +190,7 @@ fn common_open_function_upper_directories(tree_view: >k4::TreeView, column_ful let full_path = tree_model.get::(&tree_model.iter(tree_path).unwrap(), column_full_path); if let Err(e) = open::that(&full_path) { - println!("Failed to open file {}, reason {}", full_path, e); + println!("Failed to open file {full_path}, reason {e}"); }; } } diff --git a/czkawka_gui/src/saving_loading.rs b/czkawka_gui/src/saving_loading.rs index 6912f9e..286f8a6 100644 --- a/czkawka_gui/src/saving_loading.rs +++ b/czkawka_gui/src/saving_loading.rs @@ -98,7 +98,7 @@ impl LoadSaveStruct { } pub fn get_integer_string(&self, key: String, default_value: String) -> String { if default_value.parse::().is_err() { - println!("Default value {} can't be convert to integer value", default_value); + println!("Default value {default_value} can't be convert to integer value"); panic!(); } let mut returned_value = self.get_string(key, default_value.clone()); @@ -119,7 +119,7 @@ impl LoadSaveStruct { &self.text_view, &flg!( "saving_loading_invalid_string", - generate_translation_hashmap(vec![("key", key), ("result", format!("{:?}", item))]) + generate_translation_hashmap(vec![("key", key), ("result", format!("{item:?}"))]) ), ); default_value @@ -145,7 +145,7 @@ impl LoadSaveStruct { &self.text_view, &flg!( "saving_loading_invalid_int", - generate_translation_hashmap(vec![("key", key), ("result", format!("{:?}", item))]) + generate_translation_hashmap(vec![("key", key), ("result", format!("{item:?}"))]) ), ); default_value @@ -178,7 +178,7 @@ impl LoadSaveStruct { &self.text_view, &flg!( "saving_loading_invalid_bool", - generate_translation_hashmap(vec![("key", key), ("result", format!("{:?}", item))]) + generate_translation_hashmap(vec![("key", key), ("result", format!("{item:?}"))]) ), ); default_value @@ -351,7 +351,7 @@ impl LoadSaveStruct { if let Some((mut config_file_handler, config_file)) = self.open_save_file(text_view_errors, true, false) { let mut data_saved: bool = false; for (key, vec_string) in &self.loaded_items { - match writeln!(config_file_handler, "{}", key) { + match writeln!(config_file_handler, "{key}") { Ok(_inspected) => { data_saved = true; } @@ -361,7 +361,7 @@ impl LoadSaveStruct { } } for data in vec_string { - match writeln!(config_file_handler, "{}", data) { + match writeln!(config_file_handler, "{data}") { Ok(_inspected) => { data_saved = true; } @@ -492,8 +492,8 @@ fn create_hash_map() -> (HashMap, HashMap) { let mut hashmap_sl: HashMap = Default::default(); for (load_text, string) in values { - hashmap_ls.insert(load_text, format!("--{}", string)); - hashmap_sl.insert(format!("--{}", string), load_text); + hashmap_ls.insert(load_text, format!("--{string}")); + hashmap_sl.insert(format!("--{string}"), load_text); } (hashmap_ls, hashmap_sl)