release v0.3.4 🥳

This commit is contained in:
Lynne Megido 2021-08-07 00:36:19 +10:00
parent ddde6acdd6
commit 0404cff8b7
Signed by: lynnesbian
GPG Key ID: F0A184B5213D9F90
7 changed files with 18 additions and 18 deletions

View File

@ -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

4
Cargo.lock generated
View File

@ -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",

View File

@ -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 <lynne@bune.city>"]
edition = "2018"
license = "GPL-3.0-or-later"

View File

@ -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

View File

@ -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 {

View File

@ -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,
}
}

View File

@ -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::<i32>());
println!(
"No type found:\t{} counts",
results.values().len() as i32 - results.values().sum::<i32>()
);
}
#[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]
);
}