semicolonic cleanse
This commit is contained in:
parent
f8dcdf8a3c
commit
1ecc6e6c6e
8 changed files with 31 additions and 26 deletions
|
@ -80,8 +80,8 @@ Dates are given in YYYY-MM-DD format.
|
||||||
(files without extensions are still skipped unless the -S flag is used)
|
(files without extensions are still skipped unless the -S flag is used)
|
||||||
#### Bugfixes
|
#### Bugfixes
|
||||||
- Fixed compilation on big endian 32-bit architectures (see
|
- 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
|
[here](https://github.com/bodil/smartstring/blob/v0.2.6/src/config.rs#L101-L103) for why that was a problem in the
|
||||||
place)
|
first place)
|
||||||
- Fixed broken tests for the [`infer`] backend
|
- Fixed broken tests for the [`infer`] backend
|
||||||
#### Other
|
#### Other
|
||||||
- Better mime type detection:
|
- Better mime type detection:
|
||||||
|
|
4
Cargo.lock
generated
4
Cargo.lock
generated
|
@ -369,9 +369,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "once_cell"
|
name = "once_cell"
|
||||||
version = "1.7.2"
|
version = "1.8.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "af8b08b04175473088b46763e51ee54da5f9a164bc162f615b91bc179dbf15a3"
|
checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "os_str_bytes"
|
name = "os_str_bytes"
|
||||||
|
|
|
@ -29,7 +29,7 @@ walkdir = "2.3.2"
|
||||||
log = "0.4.14"
|
log = "0.4.14"
|
||||||
mime_guess = { package = "new_mime_guess", version = "2.1.0" }
|
mime_guess = { package = "new_mime_guess", version = "2.1.0" }
|
||||||
snailquote = "0.3.0"
|
snailquote = "0.3.0"
|
||||||
once_cell = "1.7.2"
|
once_cell = "1.8.0"
|
||||||
rayon = { version = "1.5.0", optional = true }
|
rayon = { version = "1.5.0", optional = true }
|
||||||
exitcode = "1.1.2"
|
exitcode = "1.1.2"
|
||||||
cfg-if = "1.0.0"
|
cfg-if = "1.0.0"
|
||||||
|
|
|
@ -2,15 +2,18 @@
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
_extra=""
|
_extra=""
|
||||||
|
_ver="+stable"
|
||||||
if [ "$1" == "ci" ]; then
|
if [ "$1" == "ci" ]; then
|
||||||
# deny on warnings when running in CI
|
# deny on warnings when running in CI
|
||||||
_extra="-Dwarnings"
|
_extra="-Dwarnings"
|
||||||
|
elif [ "$1" == "nightly" ]; then
|
||||||
|
_ver="+nightly"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# allow find to fail
|
# allow find to fail
|
||||||
find . -name '*.rs' -exec touch "{}" \; || true
|
find . -name '*.rs' -exec touch "{}" \; || true
|
||||||
|
|
||||||
cargo clippy --all-features --tests -- \
|
cargo $_ver clippy --all-features --tests -- \
|
||||||
-W clippy::nursery \
|
-W clippy::nursery \
|
||||||
-W clippy::perf \
|
-W clippy::perf \
|
||||||
-W clippy::pedantic \
|
-W clippy::pedantic \
|
||||||
|
@ -20,7 +23,6 @@ cargo clippy --all-features --tests -- \
|
||||||
-W clippy::lossy_float_literal \
|
-W clippy::lossy_float_literal \
|
||||||
-W clippy::multiple_inherent_impl \
|
-W clippy::multiple_inherent_impl \
|
||||||
-W clippy::string_to_string \
|
-W clippy::string_to_string \
|
||||||
-W clippy::wrong_pub_self_convention \
|
|
||||||
-A clippy::unused_io_amount \
|
-A clippy::unused_io_amount \
|
||||||
-A clippy::redundant_closure_for_method_calls \
|
-A clippy::redundant_closure_for_method_calls \
|
||||||
-A clippy::shadow_unrelated \
|
-A clippy::shadow_unrelated \
|
||||||
|
|
2
clippy.toml
Normal file
2
clippy.toml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
# avoid-breaking-exported-api = false # only available on nightly for now
|
||||||
|
cognitive-complexity-threshold = 15
|
|
@ -84,9 +84,9 @@ fn smart_write<W: Write>(f: &mut W, writeables: &[Writable]) -> io::Result<()> {
|
||||||
Writable::Newline => {
|
Writable::Newline => {
|
||||||
cfg_if! {
|
cfg_if! {
|
||||||
if #[cfg(windows)] {
|
if #[cfg(windows)] {
|
||||||
write!(f, "\r\n")?
|
write!(f, "\r\n")?;
|
||||||
} else {
|
} 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
|
// 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
|
// need to be escaped. however, it's Best Practice™ to escape such strings anyway, so we prefix/suffix the
|
||||||
// escaped string with single quotes.
|
// escaped string with single quotes.
|
||||||
write!(f, "'{}'", escaped)?
|
write!(f, "'{}'", escaped)?;
|
||||||
} else {
|
} else {
|
||||||
write!(f, "{}", escaped)?
|
write!(f, "{}", escaped)?;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
write!(f, "'")?;
|
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())?;
|
f.write_all(&*path.as_os_str().as_bytes())?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
write!(f, "'")?
|
write!(f, "'")?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -169,9 +169,9 @@ pub trait Format {
|
||||||
|
|
||||||
for finding in findings {
|
for finding in findings {
|
||||||
if let Some(ext) = finding.recommended_extension() {
|
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 {
|
} else {
|
||||||
self.no_known_extension(f, finding.file)?
|
self.no_known_extension(f, finding.file)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,7 @@ cfg_if! {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
|
#[allow(clippy::cognitive_complexity)]
|
||||||
fn main() {
|
fn main() {
|
||||||
let args: parameters::Parameters = parameters::Parameters::parse();
|
let args: parameters::Parameters = parameters::Parameters::parse();
|
||||||
|
|
||||||
|
@ -126,7 +127,7 @@ fn main() {
|
||||||
r.file,
|
r.file,
|
||||||
r.mime,
|
r.mime,
|
||||||
r.recommended_extension().unwrap_or_else(|| "???".into())
|
r.recommended_extension().unwrap_or_else(|| "???".into())
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
Err(f) => warn!("{}", f),
|
Err(f) => warn!("{}", f),
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ fn get_ext() {
|
||||||
ext_checks.insert(Path::new(".hidden"), None);
|
ext_checks.insert(Path::new(".hidden"), None);
|
||||||
|
|
||||||
for (path, ext) in ext_checks {
|
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,
|
follow_symlinks: true,
|
||||||
},
|
},
|
||||||
"ScanOpts are incorrect"
|
"ScanOpts are incorrect"
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -214,7 +214,7 @@ fn positional_args() {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
Parameters::parse_from(vec!["fif", flag, "images", "directory"]).dir,
|
Parameters::parse_from(vec!["fif", flag, "images", "directory"]).dir,
|
||||||
PathBuf::from("directory")
|
PathBuf::from("directory")
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -272,12 +272,12 @@ fn exclude_set_overrides_include_set() {
|
||||||
.iter()
|
.iter()
|
||||||
.chain(ExtensionSet::Video.extensions().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
|
// ensure all of images' extensions are excluded
|
||||||
for ext in ExtensionSet::Images.extensions() {
|
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 {
|
for (mime, count) in &results {
|
||||||
println!("{}:\t{} counts", mime, count);
|
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]
|
#[test]
|
||||||
|
@ -360,7 +360,7 @@ fn outputs_move_commands() {
|
||||||
"{} output doesn't contain move command!\n===\n{}",
|
"{} output doesn't contain move command!\n===\n{}",
|
||||||
format,
|
format,
|
||||||
contents
|
contents
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -394,7 +394,7 @@ fn test_json() {
|
||||||
contents.contains(IMAGE_JPEG.essence_str()),
|
contents.contains(IMAGE_JPEG.essence_str()),
|
||||||
"JSON output doesn't contain move command!\n===\n{}",
|
"JSON output doesn't contain move command!\n===\n{}",
|
||||||
contents
|
contents
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -412,7 +412,7 @@ fn media_contains_audio_video_images() {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
Parameters::parse_from(&["fif", "-E", "media"]).extensions(),
|
Parameters::parse_from(&["fif", "-E", "media"]).extensions(),
|
||||||
Parameters::parse_from(&["fif", "-E", "audio,video,images"]).extensions()
|
Parameters::parse_from(&["fif", "-E", "audio,video,images"]).extensions()
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -429,7 +429,7 @@ fn writables_is_correct() {
|
||||||
Writable::Space
|
Writable::Space
|
||||||
],
|
],
|
||||||
writables!["henlo", (Path::new("henlo")), Newline, Space]
|
writables!["henlo", (Path::new("henlo")), Newline, Space]
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -452,6 +452,6 @@ fn verbosity() {
|
||||||
expected_results.insert("-vvvvvvvv", "trace");
|
expected_results.insert("-vvvvvvvv", "trace");
|
||||||
|
|
||||||
for (flags, level) in expected_results {
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue