style: apply rustfmt
Maybe 2024 changes? Note that we now set `edition = "2024"` explicitly in `rustfmt.toml`. Without this, it seems like it's possible in some cases for rustfmt to run under an older edition's style. Not sure how though.
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
use std::fmt::Write;
|
||||
use std::path::{is_separator, Path};
|
||||
use std::path::{Path, is_separator};
|
||||
|
||||
use regex_automata::meta::Regex;
|
||||
|
||||
use crate::{new_regex, Candidate, Error, ErrorKind};
|
||||
use crate::{Candidate, Error, ErrorKind, new_regex};
|
||||
|
||||
/// Describes a matching strategy for a particular pattern.
|
||||
///
|
||||
@@ -340,11 +340,7 @@ impl Glob {
|
||||
let Token::Literal(c) = *t else { return None };
|
||||
lit.push(c);
|
||||
}
|
||||
if lit.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(lit)
|
||||
}
|
||||
if lit.is_empty() { None } else { Some(lit) }
|
||||
}
|
||||
|
||||
/// Returns an extension if this pattern matches a file path if and only
|
||||
@@ -385,11 +381,7 @@ impl Glob {
|
||||
_ => return None,
|
||||
}
|
||||
}
|
||||
if lit.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(lit)
|
||||
}
|
||||
if lit.is_empty() { None } else { Some(lit) }
|
||||
}
|
||||
|
||||
/// This is like `ext`, but returns an extension even if it isn't sufficient
|
||||
@@ -452,11 +444,7 @@ impl Glob {
|
||||
if need_sep {
|
||||
lit.push('/');
|
||||
}
|
||||
if lit.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(lit)
|
||||
}
|
||||
if lit.is_empty() { None } else { Some(lit) }
|
||||
}
|
||||
|
||||
/// Returns a literal suffix of this pattern if the entire pattern matches
|
||||
@@ -505,11 +493,7 @@ impl Glob {
|
||||
let Token::Literal(c) = *t else { return None };
|
||||
lit.push(c);
|
||||
}
|
||||
if lit.is_empty() || lit == "/" {
|
||||
None
|
||||
} else {
|
||||
Some((lit, entire))
|
||||
}
|
||||
if lit.is_empty() || lit == "/" { None } else { Some((lit, entire)) }
|
||||
}
|
||||
|
||||
/// If this pattern only needs to inspect the basename of a file path,
|
||||
|
||||
@@ -120,11 +120,11 @@ use std::{
|
||||
|
||||
use {
|
||||
aho_corasick::AhoCorasick,
|
||||
bstr::{ByteSlice, ByteVec, B},
|
||||
bstr::{B, ByteSlice, ByteVec},
|
||||
regex_automata::{
|
||||
PatternSet,
|
||||
meta::Regex,
|
||||
util::pool::{Pool, PoolGuard},
|
||||
PatternSet,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -634,11 +634,7 @@ impl<'a> Candidate<'a> {
|
||||
}
|
||||
|
||||
fn path_prefix(&self, max: usize) -> &[u8] {
|
||||
if self.path.len() <= max {
|
||||
&*self.path
|
||||
} else {
|
||||
&self.path[..max]
|
||||
}
|
||||
if self.path.len() <= max { &*self.path } else { &self.path[..max] }
|
||||
}
|
||||
|
||||
fn path_suffix(&self, max: usize) -> &[u8] {
|
||||
|
||||
@@ -88,7 +88,7 @@ pub(crate) fn normalize_path(mut path: Cow<[u8]>) -> Cow<[u8]> {
|
||||
mod tests {
|
||||
use std::borrow::Cow;
|
||||
|
||||
use bstr::{ByteVec, B};
|
||||
use bstr::{B, ByteVec};
|
||||
|
||||
use super::{file_name_ext, normalize_path};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user