Clean up clippy warnings

This commit is contained in:
garlic-hub 2024-03-08 10:46:24 -08:00
parent 3b2fd158b5
commit 0788c43c3f
No known key found for this signature in database
4 changed files with 6 additions and 6 deletions

View File

@ -113,7 +113,7 @@ impl Eq for DirEntry {}
impl PartialOrd for DirEntry { impl PartialOrd for DirEntry {
#[inline] #[inline]
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> { fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
self.path().partial_cmp(other.path()) Some(self.cmp(other))
} }
} }

View File

@ -41,7 +41,7 @@ pub(super) fn tokenize(input: &str) -> ArgumentTemplate {
let mut remaining = input; let mut remaining = input;
let mut buf = String::new(); let mut buf = String::new();
let placeholders = PLACEHOLDERS.get_or_init(|| { let placeholders = PLACEHOLDERS.get_or_init(|| {
AhoCorasick::new(&["{{", "}}", "{}", "{/}", "{//}", "{.}", "{/.}"]).unwrap() AhoCorasick::new(["{{", "}}", "{}", "{/}", "{//}", "{.}", "{/.}"]).unwrap()
}); });
while let Some(m) = placeholders.find(remaining) { while let Some(m) = placeholders.find(remaining) {
match m.pattern().as_u32() { match m.pattern().as_u32() {

View File

@ -16,7 +16,7 @@ fn hir_has_uppercase_char(hir: &Hir) -> bool {
use regex_syntax::hir::*; use regex_syntax::hir::*;
match hir.kind() { match hir.kind() {
HirKind::Literal(Literal(bytes)) => match std::str::from_utf8(&bytes) { HirKind::Literal(Literal(bytes)) => match std::str::from_utf8(bytes) {
Ok(s) => s.chars().any(|c| c.is_uppercase()), Ok(s) => s.chars().any(|c| c.is_uppercase()),
Err(_) => bytes.iter().any(|b| char::from(*b).is_uppercase()), Err(_) => bytes.iter().any(|b| char::from(*b).is_uppercase()),
}, },

View File

@ -250,7 +250,7 @@ impl<'a, W: Write> ReceiverBuffer<'a, W> {
/// Output a path. /// Output a path.
fn print(&mut self, entry: &DirEntry) -> Result<(), ExitCode> { fn print(&mut self, entry: &DirEntry) -> Result<(), ExitCode> {
output::print_entry(&mut self.stdout, entry, &self.config); output::print_entry(&mut self.stdout, entry, self.config);
if self.interrupt_flag.load(Ordering::Relaxed) { if self.interrupt_flag.load(Ordering::Relaxed) {
// Ignore any errors on flush, because we're about to exit anyway // Ignore any errors on flush, because we're about to exit anyway
@ -413,7 +413,7 @@ impl WorkerState {
// This will be set to `Some` if the `--exec` argument was supplied. // This will be set to `Some` if the `--exec` argument was supplied.
if let Some(ref cmd) = config.command { if let Some(ref cmd) = config.command {
if cmd.in_batch_mode() { if cmd.in_batch_mode() {
exec::batch(rx.into_iter().flatten(), cmd, &config) exec::batch(rx.into_iter().flatten(), cmd, config)
} else { } else {
let out_perm = Mutex::new(()); let out_perm = Mutex::new(());
@ -426,7 +426,7 @@ impl WorkerState {
// Spawn a job thread that will listen for and execute inputs. // Spawn a job thread that will listen for and execute inputs.
let handle = scope let handle = scope
.spawn(|| exec::job(rx.into_iter().flatten(), cmd, &out_perm, &config)); .spawn(|| exec::job(rx.into_iter().flatten(), cmd, &out_perm, config));
// Push the handle of the spawned thread into the vector for later joining. // Push the handle of the spawned thread into the vector for later joining.
handles.push(handle); handles.push(handle);