style: Make clippy happy

This commit is contained in:
Ed Page 2024-12-02 11:33:06 -06:00
parent 9b241e15e1
commit 9efaabdf84
9 changed files with 25 additions and 25 deletions

View file

@ -62,14 +62,14 @@ impl<V> DictMap<V> {
} }
} }
impl<'s> phf_shared::PhfHash for crate::InsensitiveStr<'s> { impl phf_shared::PhfHash for crate::InsensitiveStr<'_> {
#[inline] #[inline]
fn phf_hash<H: core::hash::Hasher>(&self, state: &mut H) { fn phf_hash<H: core::hash::Hasher>(&self, state: &mut H) {
core::hash::Hash::hash(self, state); core::hash::Hash::hash(self, state);
} }
} }
impl<'s> phf_shared::FmtConst for crate::InsensitiveStr<'s> { impl phf_shared::FmtConst for crate::InsensitiveStr<'_> {
fn fmt_const(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { fn fmt_const(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self { match self {
crate::InsensitiveStr::Ascii(_) => f.write_str("dictgen::InsensitiveStr::Ascii(")?, crate::InsensitiveStr::Ascii(_) => f.write_str("dictgen::InsensitiveStr::Ascii(")?,

View file

@ -98,30 +98,30 @@ impl<'s> From<unicase::UniCase<&'s str>> for InsensitiveStr<'s> {
} }
} }
impl<'s1, 's2> PartialEq<InsensitiveStr<'s2>> for InsensitiveStr<'s1> { impl<'s2> PartialEq<InsensitiveStr<'s2>> for InsensitiveStr<'_> {
#[inline] #[inline]
fn eq(&self, other: &InsensitiveStr<'s2>) -> bool { fn eq(&self, other: &InsensitiveStr<'s2>) -> bool {
self.convert() == other.convert() self.convert() == other.convert()
} }
} }
impl<'s> Eq for InsensitiveStr<'s> {} impl Eq for InsensitiveStr<'_> {}
impl<'s> core::hash::Hash for InsensitiveStr<'s> { impl core::hash::Hash for InsensitiveStr<'_> {
#[inline] #[inline]
fn hash<H: core::hash::Hasher>(&self, hasher: &mut H) { fn hash<H: core::hash::Hasher>(&self, hasher: &mut H) {
self.convert().hash(hasher); self.convert().hash(hasher);
} }
} }
impl<'s> core::fmt::Debug for InsensitiveStr<'s> { impl core::fmt::Debug for InsensitiveStr<'_> {
#[inline] #[inline]
fn fmt(&self, fmt: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { fn fmt(&self, fmt: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
core::fmt::Debug::fmt(self.into_inner(), fmt) core::fmt::Debug::fmt(self.into_inner(), fmt)
} }
} }
impl<'s> core::fmt::Display for InsensitiveStr<'s> { impl core::fmt::Display for InsensitiveStr<'_> {
#[inline] #[inline]
fn fmt(&self, fmt: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { fn fmt(&self, fmt: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
core::fmt::Display::fmt(self.into_inner(), fmt) core::fmt::Display::fmt(self.into_inner(), fmt)

View file

@ -245,7 +245,7 @@ mod codegen {
value: Option<V>, value: Option<V>,
} }
impl<'s, V> DynNode<'s, V> { impl<V> DynNode<'_, V> {
fn burst(&mut self, limit: usize) { fn burst(&mut self, limit: usize) {
self.children.burst(limit); self.children.burst(limit);
} }
@ -256,7 +256,7 @@ mod codegen {
Flat(Vec<(&'s [u8], V)>), Flat(Vec<(&'s [u8], V)>),
} }
impl<'s, V> DynChild<'s, V> { impl<V> DynChild<'_, V> {
fn burst(&mut self, limit: usize) { fn burst(&mut self, limit: usize) {
match self { match self {
DynChild::Nested(children) => { DynChild::Nested(children) => {

View file

@ -36,7 +36,7 @@ impl<'r> MessageStatus<'r> {
} }
} }
impl<'r> Report for MessageStatus<'r> { impl Report for MessageStatus<'_> {
fn report(&self, msg: Message<'_>) -> Result<(), std::io::Error> { fn report(&self, msg: Message<'_>) -> Result<(), std::io::Error> {
if msg.is_typo() { if msg.is_typo() {
self.typos_found.store(true, atomic::Ordering::Relaxed); self.typos_found.store(true, atomic::Ordering::Relaxed);

View file

@ -264,7 +264,7 @@ impl<'i, 'w, D: typos::Dictionary> Override<'i, 'w, D> {
} }
} }
impl<'i, 'w, D: typos::Dictionary> typos::Dictionary for Override<'i, 'w, D> { impl<D: typos::Dictionary> typos::Dictionary for Override<'_, '_, D> {
fn correct_ident<'s>(&'s self, ident: typos::tokens::Identifier<'_>) -> Option<Status<'s>> { fn correct_ident<'s>(&'s self, ident: typos::tokens::Identifier<'_>) -> Option<Status<'s>> {
for ignored in &self.ignored_identifiers { for ignored in &self.ignored_identifiers {
if ignored.is_match(ident.token()) { if ignored.is_match(ident.token()) {

View file

@ -359,7 +359,7 @@ pub struct Policy<'t, 'd, 'i> {
pub ignore: &'i [regex::Regex], pub ignore: &'i [regex::Regex],
} }
impl<'t, 'd, 'i> Policy<'t, 'd, 'i> { impl Policy<'_, '_, '_> {
pub fn new() -> Self { pub fn new() -> Self {
Default::default() Default::default()
} }
@ -369,7 +369,7 @@ static DEFAULT_TOKENIZER: typos::tokens::Tokenizer = typos::tokens::Tokenizer::n
static DEFAULT_DICT: crate::dict::BuiltIn = crate::dict::BuiltIn::new(crate::config::Locale::En); static DEFAULT_DICT: crate::dict::BuiltIn = crate::dict::BuiltIn::new(crate::config::Locale::En);
static DEFAULT_IGNORE: &[regex::Regex] = &[]; static DEFAULT_IGNORE: &[regex::Regex] = &[];
impl<'t, 'd, 'i> Default for Policy<'t, 'd, 'i> { impl Default for Policy<'_, '_, '_> {
fn default() -> Self { fn default() -> Self {
Self { Self {
check_filenames: true, check_filenames: true,

View file

@ -80,7 +80,7 @@ pub struct Typo<'m> {
pub corrections: typos::Status<'m>, pub corrections: typos::Status<'m>,
} }
impl<'m> Default for Typo<'m> { impl Default for Typo<'_> {
fn default() -> Self { fn default() -> Self {
Self { Self {
context: None, context: None,
@ -100,7 +100,7 @@ pub enum Context<'m> {
Path(PathContext<'m>), Path(PathContext<'m>),
} }
impl<'m> std::fmt::Display for Context<'m> { impl std::fmt::Display for Context<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
match self { match self {
Context::File(c) => write!(f, "{}:{}", c.path.display(), c.line_num), Context::File(c) => write!(f, "{}:{}", c.path.display(), c.line_num),
@ -116,7 +116,7 @@ pub struct FileContext<'m> {
pub line_num: usize, pub line_num: usize,
} }
impl<'m> Default for FileContext<'m> { impl Default for FileContext<'_> {
fn default() -> Self { fn default() -> Self {
Self { Self {
path: std::path::Path::new("-"), path: std::path::Path::new("-"),
@ -131,7 +131,7 @@ pub struct PathContext<'m> {
pub path: &'m std::path::Path, pub path: &'m std::path::Path,
} }
impl<'m> Default for PathContext<'m> { impl Default for PathContext<'_> {
fn default() -> Self { fn default() -> Self {
Self { Self {
path: std::path::Path::new("-"), path: std::path::Path::new("-"),
@ -160,7 +160,7 @@ impl<'m> FileType<'m> {
} }
} }
impl<'m> Default for FileType<'m> { impl Default for FileType<'_> {
fn default() -> Self { fn default() -> Self {
Self { Self {
path: std::path::Path::new("-"), path: std::path::Path::new("-"),
@ -181,7 +181,7 @@ impl<'m> File<'m> {
} }
} }
impl<'m> Default for File<'m> { impl Default for File<'_> {
fn default() -> Self { fn default() -> Self {
Self { Self {
path: std::path::Path::new("-"), path: std::path::Path::new("-"),
@ -198,7 +198,7 @@ pub struct Parse<'m> {
pub data: &'m str, pub data: &'m str,
} }
impl<'m> Default for Parse<'m> { impl Default for Parse<'_> {
fn default() -> Self { fn default() -> Self {
Self { Self {
context: None, context: None,
@ -216,13 +216,13 @@ pub struct Error<'m> {
pub msg: String, pub msg: String,
} }
impl<'m> Error<'m> { impl Error<'_> {
pub fn new(msg: String) -> Self { pub fn new(msg: String) -> Self {
Self { context: None, msg } Self { context: None, msg }
} }
} }
impl<'m> Default for Error<'m> { impl Default for Error<'_> {
fn default() -> Self { fn default() -> Self {
Self { Self {
context: None, context: None,

View file

@ -70,7 +70,7 @@ pub struct Typo<'m> {
pub corrections: crate::Status<'m>, pub corrections: crate::Status<'m>,
} }
impl<'m> Typo<'m> { impl Typo<'_> {
pub fn into_owned(self) -> Typo<'static> { pub fn into_owned(self) -> Typo<'static> {
Typo { Typo {
byte_offset: self.byte_offset, byte_offset: self.byte_offset,
@ -94,7 +94,7 @@ impl<'m> Typo<'m> {
} }
} }
impl<'m> Default for Typo<'m> { impl Default for Typo<'_> {
fn default() -> Self { fn default() -> Self {
Self { Self {
byte_offset: 0, byte_offset: 0,

View file

@ -22,7 +22,7 @@ impl<'i> ClusterIter<'i> {
} }
} }
impl<'i> Iterator for ClusterIter<'i> { impl Iterator for ClusterIter<'_> {
type Item = Cluster; type Item = Cluster;
fn next(&mut self) -> Option<Cluster> { fn next(&mut self) -> Option<Cluster> {