diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
index 725f4da..8778a14 100644
--- a/.idea/inspectionProfiles/Project_Default.xml
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -3,5 +3,8 @@
+
+
+
\ No newline at end of file
diff --git a/Cargo.lock b/Cargo.lock
index a5f3c5a..c7b11ad 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1,5 +1,7 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
+version = 3
+
[[package]]
name = "arrayvec"
version = "0.5.2"
@@ -105,9 +107,9 @@ dependencies = [
[[package]]
name = "crossbeam-deque"
-version = "0.8.0"
+version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9"
+checksum = "6455c0ca19f0d2fbf751b908d5c55c1f5cbc65e03c4225427254b46890bdde1e"
dependencies = [
"cfg-if",
"crossbeam-epoch",
@@ -549,18 +551,18 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
[[package]]
name = "serde"
-version = "1.0.126"
+version = "1.0.127"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ec7505abeacaec74ae4778d9d9328fe5a5d04253220a85c4ee022239fc996d03"
+checksum = "f03b9878abf6d14e6779d3f24f07b2cfa90352cfec4acc5aab8f1ac7f146fae8"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
-version = "1.0.126"
+version = "1.0.127"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "963a7dbc9895aeac7ac90e74f34a5d5261828f79df35cbed41e10189d3804d43"
+checksum = "a024926d3432516606328597e0f224a51355a493b49fdd67e9209187cbe55ecc"
dependencies = [
"proc-macro2",
"quote",
diff --git a/clippy.sh b/clippy.sh
index 441dbdb..08e6a8d 100755
--- a/clippy.sh
+++ b/clippy.sh
@@ -1,6 +1,6 @@
#!/bin/bash
set -e
-source $HOME/.cargo/env || true
+source "$HOME"/.cargo/env || true
_extra=""
_ver=""
diff --git a/src/main.rs b/src/main.rs
index 8056724..c0076e2 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -17,7 +17,6 @@
#![forbid(unsafe_code)]
#![warn(trivial_casts, unused_lifetimes, unused_qualifications)]
-use std::ffi::OsStr;
use std::io::{stdout, BufWriter, Write};
use std::path::Path;
use std::process::exit;
@@ -213,7 +212,7 @@ fn wanted_file(
return true;
}
- if let Some(ext) = extension_from_path(entry.path()) {
+ if let Some(ext) = entry.path().extension() {
// file has extension - discard invalid UTF-8 and normalise it to lowercase.
let ext = ext.to_string_lossy().to_lowercase();
let ext = ext.as_str();
@@ -231,9 +230,6 @@ fn wanted_file(
}
}
-/// Given a file path, returns its extension, using [`std::path::Path::extension`].
-fn extension_from_path(path: &Path) -> Option<&OsStr> { path.extension() }
-
/// Inspects the given entry, returning a [`Findings`] on success and a [`ScanError`] on failure.
///
/// In the event of an IO error, the returned [`ScanError`] will be of type [`ScanError::File`]. Otherwise, a
@@ -254,7 +250,7 @@ fn scan_file(entry: &DirEntry, canonical_paths: bool) -> Result IMAGE_JPEG,
"png" => IMAGE_PNG,
"pdf" => APPLICATION_PDF,
@@ -173,7 +172,7 @@ fn simple_directory() {
},
"Incorrect MIME type detected - got {:?} for a {:?} file",
result.mime,
- ext.unwrap()
+ ext
);
}
}
diff --git a/src/utils.rs b/src/utils.rs
index 1feb668..2f1630c 100644
--- a/src/utils.rs
+++ b/src/utils.rs
@@ -23,7 +23,7 @@ static CLAP_LONG_VERSION: OnceCell = OnceCell::new();
/// Sets [`CLAP_VERSION`] to be the version defined in Cargo.toml, prefixed with a v (e.g. "v0.3.1"), then returns it as
/// a String.
-pub fn clap_version() -> &'static str { CLAP_VERSION.get_or_init(|| format!("v{}", VERSION.unwrap_or("???"))) }
+pub fn clap_version() -> &'static str { CLAP_VERSION.get_or_init(|| String::from("v") + VERSION.unwrap_or("???")) }
/// Sets [`CLAP_LONG_VERSION`] to be similar to [`CLAP_VERSION`], followed by the chosen backend in parentheses (e.g.
/// "v0.3.1 (XDG-Mime backend)"), then returns it as a String.