semicolonic cleanse

This commit is contained in:
Lynne Megido 2021-06-14 16:53:41 +10:00
parent f8dcdf8a3c
commit 1ecc6e6c6e
Signed by: lynnesbian
GPG Key ID: F0A184B5213D9F90
8 changed files with 31 additions and 26 deletions

View File

@ -80,8 +80,8 @@ Dates are given in YYYY-MM-DD format.
(files without extensions are still skipped unless the -S flag is used)
#### Bugfixes
- Fixed compilation on big endian 32-bit architectures (see
[here](https://github.com/bodil/smartstring/blob/v0.2.6/src/config.rs#L101-L103) for why that was a problem in the first
place)
[here](https://github.com/bodil/smartstring/blob/v0.2.6/src/config.rs#L101-L103) for why that was a problem in the
first place)
- Fixed broken tests for the [`infer`] backend
#### Other
- Better mime type detection:

4
Cargo.lock generated
View File

@ -369,9 +369,9 @@ dependencies = [
[[package]]
name = "once_cell"
version = "1.7.2"
version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af8b08b04175473088b46763e51ee54da5f9a164bc162f615b91bc179dbf15a3"
checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56"
[[package]]
name = "os_str_bytes"

View File

@ -29,7 +29,7 @@ walkdir = "2.3.2"
log = "0.4.14"
mime_guess = { package = "new_mime_guess", version = "2.1.0" }
snailquote = "0.3.0"
once_cell = "1.7.2"
once_cell = "1.8.0"
rayon = { version = "1.5.0", optional = true }
exitcode = "1.1.2"
cfg-if = "1.0.0"

View File

@ -2,15 +2,18 @@
set -e
_extra=""
_ver="+stable"
if [ "$1" == "ci" ]; then
# deny on warnings when running in CI
_extra="-Dwarnings"
elif [ "$1" == "nightly" ]; then
_ver="+nightly"
fi
# allow find to fail
find . -name '*.rs' -exec touch "{}" \; || true
cargo clippy --all-features --tests -- \
cargo $_ver clippy --all-features --tests -- \
-W clippy::nursery \
-W clippy::perf \
-W clippy::pedantic \
@ -20,7 +23,6 @@ cargo clippy --all-features --tests -- \
-W clippy::lossy_float_literal \
-W clippy::multiple_inherent_impl \
-W clippy::string_to_string \
-W clippy::wrong_pub_self_convention \
-A clippy::unused_io_amount \
-A clippy::redundant_closure_for_method_calls \
-A clippy::shadow_unrelated \

2
clippy.toml Normal file
View File

@ -0,0 +1,2 @@
# avoid-breaking-exported-api = false # only available on nightly for now
cognitive-complexity-threshold = 15

View File

@ -84,9 +84,9 @@ fn smart_write<W: Write>(f: &mut W, writeables: &[Writable]) -> io::Result<()> {
Writable::Newline => {
cfg_if! {
if #[cfg(windows)] {
write!(f, "\r\n")?
write!(f, "\r\n")?;
} else {
writeln!(f,)?
writeln!(f,)?;
}
}
}
@ -98,9 +98,9 @@ fn smart_write<W: Write>(f: &mut W, writeables: &[Writable]) -> io::Result<()> {
// the escaped string is the same as the input - this will occur for inputs like "file.txt" which don't
// need to be escaped. however, it's Best Practice™ to escape such strings anyway, so we prefix/suffix the
// escaped string with single quotes.
write!(f, "'{}'", escaped)?
write!(f, "'{}'", escaped)?;
} else {
write!(f, "{}", escaped)?
write!(f, "{}", escaped)?;
}
} else {
write!(f, "'")?;
@ -114,7 +114,7 @@ fn smart_write<W: Write>(f: &mut W, writeables: &[Writable]) -> io::Result<()> {
f.write_all(&*path.as_os_str().as_bytes())?;
}
}
write!(f, "'")?
write!(f, "'")?;
}
}
}
@ -169,9 +169,9 @@ pub trait Format {
for finding in findings {
if let Some(ext) = finding.recommended_extension() {
self.rename(f, finding.file, &finding.file.with_extension(ext.as_str()))?
self.rename(f, finding.file, &finding.file.with_extension(ext.as_str()))?;
} else {
self.no_known_extension(f, finding.file)?
self.no_known_extension(f, finding.file)?;
}
}

View File

@ -61,6 +61,7 @@ cfg_if! {
}
#[doc(hidden)]
#[allow(clippy::cognitive_complexity)]
fn main() {
let args: parameters::Parameters = parameters::Parameters::parse();
@ -126,7 +127,7 @@ fn main() {
r.file,
r.mime,
r.recommended_extension().unwrap_or_else(|| "???".into())
)
);
}
Err(f) => warn!("{}", f),
}

View File

@ -49,7 +49,7 @@ fn get_ext() {
ext_checks.insert(Path::new(".hidden"), None);
for (path, ext) in ext_checks {
assert_eq!(extension_from_path(path), ext)
assert_eq!(extension_from_path(path), ext);
}
}
@ -204,7 +204,7 @@ fn argument_parsing() {
follow_symlinks: true,
},
"ScanOpts are incorrect"
)
);
}
#[test]
@ -214,7 +214,7 @@ fn positional_args() {
assert_eq!(
Parameters::parse_from(vec!["fif", flag, "images", "directory"]).dir,
PathBuf::from("directory")
)
);
}
}
@ -272,12 +272,12 @@ fn exclude_set_overrides_include_set() {
.iter()
.chain(ExtensionSet::Video.extensions().iter())
{
assert!(extensions.contains(&ext), "Extensions should contain {}!", ext)
assert!(extensions.contains(&ext), "Extensions should contain {}!", ext);
}
// ensure all of images' extensions are excluded
for ext in ExtensionSet::Images.extensions() {
assert!(!extensions.contains(&ext), "Extensions should not contain {}!", ext)
assert!(!extensions.contains(&ext), "Extensions should not contain {}!", ext);
}
}
@ -322,7 +322,7 @@ fn identify_random_bytes() {
for (mime, count) in &results {
println!("{}:\t{} counts", mime, count);
}
println!("No type found:\t{} counts", 500 - results.values().sum::<i32>())
println!("No type found:\t{} counts", 500 - results.values().sum::<i32>());
}
#[test]
@ -360,7 +360,7 @@ fn outputs_move_commands() {
"{} output doesn't contain move command!\n===\n{}",
format,
contents
)
);
}
}
@ -394,7 +394,7 @@ fn test_json() {
contents.contains(IMAGE_JPEG.essence_str()),
"JSON output doesn't contain move command!\n===\n{}",
contents
)
);
}
#[test]
@ -412,7 +412,7 @@ fn media_contains_audio_video_images() {
assert_eq!(
Parameters::parse_from(&["fif", "-E", "media"]).extensions(),
Parameters::parse_from(&["fif", "-E", "audio,video,images"]).extensions()
)
);
}
#[test]
@ -429,7 +429,7 @@ fn writables_is_correct() {
Writable::Space
],
writables!["henlo", (Path::new("henlo")), Newline, Space]
)
);
}
#[test]
@ -452,6 +452,6 @@ fn verbosity() {
expected_results.insert("-vvvvvvvv", "trace");
for (flags, level) in expected_results {
assert_eq!(Parameters::parse_from(&["fif", flags]).default_verbosity(), level)
assert_eq!(Parameters::parse_from(&["fif", flags]).default_verbosity(), level);
}
}