From 0404cff8b757f512f13657a99708e97124049a3d Mon Sep 17 00:00:00 2001 From: Lynnesbian Date: Sat, 7 Aug 2021 00:36:19 +1000 Subject: [PATCH] =?UTF-8?q?release=20v0.3.4=20=F0=9F=A5=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 2 +- Cargo.lock | 4 +--- Cargo.toml | 2 +- clippy.sh | 4 ++++ src/main.rs | 10 ++++------ src/parameters.rs | 3 ++- src/tests/mod.rs | 11 +++++------ 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dcb5f55..c3910b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ Dates are given in YYYY-MM-DD format. ## v0.3 -### v0.3.4 (2021-mm-dd) +### v0.3.4 (2021-08-07) #### Features - Added `-I`/`--ignore-unknown-exts` flag for ignoring files with unknown extensions - for example, if fif doesn't know what a ".fake" file is, setting this flag will prevent it from renaming "photo.fake" to "photo.jpg". This is useful diff --git a/Cargo.lock b/Cargo.lock index 677ad75..0ba15d6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,7 +1,5 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 - [[package]] name = "arrayvec" version = "0.5.2" @@ -185,7 +183,7 @@ checksum = "de853764b47027c2e862a995c34978ffa63c1501f2e15f987ba11bd4f9bba193" [[package]] name = "fif" -version = "0.3.3" +version = "0.3.4" dependencies = [ "cached", "cfg-if", diff --git a/Cargo.toml b/Cargo.toml index b299661..7d10e87 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "fif" description = "A command-line tool for detecting and optionally correcting files with incorrect extensions." -version = "0.3.3" +version = "0.3.4" authors = ["Lynnesbian "] edition = "2018" license = "GPL-3.0-or-later" diff --git a/clippy.sh b/clippy.sh index 08e6a8d..e625bfb 100755 --- a/clippy.sh +++ b/clippy.sh @@ -32,6 +32,8 @@ for backend in "${_backends[@]}"; do -A clippy::shadow_unrelated \ -A clippy::option_if_let_else \ -A clippy::multiple-crate-versions \ + -A clippy::cast-possible-truncation \ + -A clippy::cast-possible-wrap \ "$_extra" done @@ -41,3 +43,5 @@ done # shadow_unrelated: sometimes things that seem unrelated are actually related ;) # option_if_let_else: the suggested code is usually harder to read than the original # multiple_crate_versions: cached uses an old version of hashbrown :c +# cast-possible-truncation: only ever used where it would be totally fine +# cast-possible-wrap: ditto diff --git a/src/main.rs b/src/main.rs index 77fc00f..bcf43a1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -33,8 +33,8 @@ use crate::formats::Format; use crate::mime_db::MimeDb; use crate::parameters::{OutputFormat, ScanOpts}; use crate::utils::{clap_long_version, os_name}; -use std::collections::BTreeSet; use mime_guess::from_ext; +use std::collections::BTreeSet; mod findings; mod formats; @@ -218,11 +218,9 @@ fn wanted_file( let ext = ext.to_string_lossy().to_lowercase(); let ext = ext.as_str(); - if scan_opts.ignore_unknown_exts { - if from_ext(ext).is_empty() { - // unknown extension, skip. - return false; - } + if scan_opts.ignore_unknown_exts && from_ext(ext).is_empty() { + // unknown extension, skip. + return false; } if let Some(exts) = exts { diff --git a/src/parameters.rs b/src/parameters.rs index dcfb8b6..6672cab 100644 --- a/src/parameters.rs +++ b/src/parameters.rs @@ -145,6 +145,7 @@ fn lowercase_exts(exts: &str) -> Result<(), String> { /// Further options relating to scanning. #[derive(PartialEq, Debug)] +#[allow(clippy::struct_excessive_bools)] pub struct ScanOpts { /// Whether hidden files and directories should be scanned. pub hidden: bool, @@ -221,7 +222,7 @@ impl Parameters { hidden: self.scan_hidden, extensionless: self.scan_extensionless, follow_symlinks: self.follow_symlinks, - ignore_unknown_exts: self.ignore_unknown_exts + ignore_unknown_exts: self.ignore_unknown_exts, } } diff --git a/src/tests/mod.rs b/src/tests/mod.rs index f9fd871..afdc82c 100644 --- a/src/tests/mod.rs +++ b/src/tests/mod.rs @@ -333,7 +333,10 @@ fn identify_random_bytes() { for (mime, count) in &results { println!("{}:\t{} counts", mime, count); } - println!("No type found:\t{} counts", results.values().len() as i32 - results.values().sum::()); + println!( + "No type found:\t{} counts", + results.values().len() as i32 - results.values().sum::() + ); } #[test] @@ -433,11 +436,7 @@ fn writables_is_correct() { use crate::writables; assert_eq!( - &[ - "henlo".into(), - Path::new("henlo").into(), - Writable::Newline, - ], + &["henlo".into(), Path::new("henlo").into(), Writable::Newline,], writables!["henlo", (Path::new("henlo")), Newline] ); }