mirror of
https://github.com/crate-ci/typos.git
synced 2026-10-17 09:35:11 +02:00
Merge pull request #1411 from epage/edition2024
chore: Migrate to 2024 edition
This commit is contained in:
+2
-2
@@ -8,8 +8,8 @@ resolver = "2"
|
||||
[workspace.package]
|
||||
repository = "https://github.com/crate-ci/typos"
|
||||
license = "MIT OR Apache-2.0"
|
||||
edition = "2021"
|
||||
rust-version = "1.80" # MSRV
|
||||
edition = "2024"
|
||||
rust-version = "1.87" # MSRV
|
||||
include = [
|
||||
"build.rs",
|
||||
"src/**/*",
|
||||
|
||||
@@ -8,7 +8,7 @@ pub use ::aho_corasick::StartKind;
|
||||
|
||||
#[cfg(feature = "codegen")]
|
||||
pub struct AhoCorasickGen<'g> {
|
||||
pub(crate) gen: crate::DictGen<'g>,
|
||||
pub(crate) r#gen: crate::DictGen<'g>,
|
||||
}
|
||||
|
||||
#[cfg(feature = "codegen")]
|
||||
@@ -21,8 +21,8 @@ impl AhoCorasickGen<'_> {
|
||||
let mut data: Vec<_> = data.collect();
|
||||
data.sort_unstable_by_key(|v| unicase::UniCase::new(v.0.as_ref().to_owned()));
|
||||
|
||||
let name = self.gen.name;
|
||||
let value_type = self.gen.value_type;
|
||||
let name = self.r#gen.name;
|
||||
let value_type = self.r#gen.value_type;
|
||||
|
||||
writeln!(file, "pub struct {name} {{")?;
|
||||
writeln!(file, " dfa: dictgen::aho_corasick::DFA,")?;
|
||||
|
||||
@@ -37,7 +37,7 @@ impl<'g> DictGen<'g> {
|
||||
#[cfg(feature = "map")]
|
||||
pub fn map(self) -> crate::MapGen<'g> {
|
||||
crate::MapGen {
|
||||
gen: self,
|
||||
r#gen: self,
|
||||
unicode: true,
|
||||
unicase: true,
|
||||
}
|
||||
@@ -45,7 +45,7 @@ impl<'g> DictGen<'g> {
|
||||
|
||||
pub fn ordered_map(self) -> crate::OrderedMapGen<'g> {
|
||||
crate::OrderedMapGen {
|
||||
gen: self,
|
||||
r#gen: self,
|
||||
unicode: true,
|
||||
unicase: true,
|
||||
}
|
||||
@@ -53,18 +53,18 @@ impl<'g> DictGen<'g> {
|
||||
|
||||
pub fn trie(self) -> crate::TrieGen<'g> {
|
||||
crate::TrieGen {
|
||||
gen: self,
|
||||
r#gen: self,
|
||||
limit: 64,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn r#match(self) -> crate::MatchGen<'g> {
|
||||
crate::MatchGen { gen: self }
|
||||
crate::MatchGen { r#gen: self }
|
||||
}
|
||||
|
||||
#[cfg(feature = "aho-corasick")]
|
||||
pub fn aho_corasick(self) -> crate::AhoCorasickGen<'g> {
|
||||
crate::AhoCorasickGen { gen: self }
|
||||
crate::AhoCorasickGen { r#gen: self }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#[cfg(feature = "aho-corasick")]
|
||||
pub mod aho_corasick;
|
||||
#[cfg(feature = "codegen")]
|
||||
mod gen;
|
||||
mod r#gen;
|
||||
mod insensitive;
|
||||
#[cfg(feature = "map")]
|
||||
mod map;
|
||||
@@ -17,12 +17,12 @@ mod trie;
|
||||
#[cfg(feature = "aho-corasick")]
|
||||
#[cfg(feature = "codegen")]
|
||||
pub use aho_corasick::AhoCorasickGen;
|
||||
#[cfg(feature = "codegen")]
|
||||
pub use gen::*;
|
||||
pub use insensitive::*;
|
||||
#[cfg(feature = "map")]
|
||||
pub use map::*;
|
||||
pub use ordered_map::*;
|
||||
#[cfg(feature = "codegen")]
|
||||
pub use r#gen::*;
|
||||
#[cfg(feature = "codegen")]
|
||||
pub use r#match::*;
|
||||
pub use trie::*;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#[cfg(feature = "codegen")]
|
||||
pub struct MapGen<'g> {
|
||||
pub(crate) gen: crate::DictGen<'g>,
|
||||
pub(crate) r#gen: crate::DictGen<'g>,
|
||||
pub(crate) unicase: bool,
|
||||
pub(crate) unicode: bool,
|
||||
}
|
||||
@@ -25,9 +25,9 @@ impl MapGen<'_> {
|
||||
let mut data: Vec<_> = data.collect();
|
||||
data.sort_unstable_by_key(|v| unicase::UniCase::new(v.0.as_ref().to_owned()));
|
||||
|
||||
let name = self.gen.name;
|
||||
let name = self.r#gen.name;
|
||||
let key_type = self.key_type();
|
||||
let value_type = self.gen.value_type;
|
||||
let value_type = self.r#gen.value_type;
|
||||
|
||||
let mut smallest = usize::MAX;
|
||||
let mut largest = usize::MIN;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#[cfg(feature = "codegen")]
|
||||
pub struct MatchGen<'g> {
|
||||
pub(crate) gen: crate::DictGen<'g>,
|
||||
pub(crate) r#gen: crate::DictGen<'g>,
|
||||
}
|
||||
|
||||
#[cfg(feature = "codegen")]
|
||||
@@ -13,8 +13,8 @@ impl MatchGen<'_> {
|
||||
let mut data: Vec<_> = data.collect();
|
||||
data.sort_unstable_by_key(|v| unicase::UniCase::new(v.0.as_ref().to_owned()));
|
||||
|
||||
let name = self.gen.name;
|
||||
let value_type = self.gen.value_type;
|
||||
let name = self.r#gen.name;
|
||||
let value_type = self.r#gen.value_type;
|
||||
|
||||
writeln!(file, "pub struct {name};")?;
|
||||
writeln!(file, "impl {name} {{")?;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#[cfg(feature = "codegen")]
|
||||
pub struct OrderedMapGen<'g> {
|
||||
pub(crate) gen: crate::DictGen<'g>,
|
||||
pub(crate) r#gen: crate::DictGen<'g>,
|
||||
pub(crate) unicase: bool,
|
||||
pub(crate) unicode: bool,
|
||||
}
|
||||
@@ -25,9 +25,9 @@ impl OrderedMapGen<'_> {
|
||||
let mut data: Vec<_> = data.collect();
|
||||
data.sort_unstable_by_key(|v| unicase::UniCase::new(v.0.as_ref().to_owned()));
|
||||
|
||||
let name = self.gen.name;
|
||||
let name = self.r#gen.name;
|
||||
let key_type = self.key_type();
|
||||
let value_type = self.gen.value_type;
|
||||
let value_type = self.r#gen.value_type;
|
||||
|
||||
let mut smallest = usize::MAX;
|
||||
let mut largest = usize::MIN;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#[cfg(feature = "codegen")]
|
||||
pub struct TrieGen<'g> {
|
||||
pub(crate) gen: crate::DictGen<'g>,
|
||||
pub(crate) r#gen: crate::DictGen<'g>,
|
||||
pub(crate) limit: usize,
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@ impl TrieGen<'_> {
|
||||
file: &mut W,
|
||||
data: impl Iterator<Item = (&'d str, V)>,
|
||||
) -> Result<(), std::io::Error> {
|
||||
let name = self.gen.name;
|
||||
let value_type = self.gen.value_type;
|
||||
let name = self.r#gen.name;
|
||||
let value_type = self.r#gen.value_type;
|
||||
codegen::generate_trie(file, name, value_type, data, self.limit)
|
||||
}
|
||||
}
|
||||
@@ -310,7 +310,7 @@ mod codegen {
|
||||
DynChild::Nested(_) => {
|
||||
unreachable!("Only overflow at this point")
|
||||
}
|
||||
DynChild::Flat(ref mut v) => {
|
||||
DynChild::Flat(v) => {
|
||||
v.push((remaining, value));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -317,7 +317,7 @@ impl TypeEngineConfig {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn patterns(&self) -> impl Iterator<Item = (KString, GlobEngineConfig)> {
|
||||
pub fn patterns(&self) -> impl Iterator<Item = (KString, GlobEngineConfig)> + use<> {
|
||||
let mut engine = Self::from_defaults();
|
||||
engine.update(self);
|
||||
engine.patterns.into_iter()
|
||||
@@ -619,23 +619,23 @@ impl std::fmt::Display for Locale {
|
||||
}
|
||||
|
||||
#[cfg(feature = "unstable-schema")]
|
||||
fn vec_string(gen: &mut schemars::SchemaGenerator) -> schemars::Schema {
|
||||
fn vec_string(r#gen: &mut schemars::SchemaGenerator) -> schemars::Schema {
|
||||
type Type = Vec<String>;
|
||||
<Type as schemars::JsonSchema>::json_schema(gen)
|
||||
<Type as schemars::JsonSchema>::json_schema(r#gen)
|
||||
}
|
||||
|
||||
#[cfg(feature = "unstable-schema")]
|
||||
fn hashmap_string_string(gen: &mut schemars::SchemaGenerator) -> schemars::Schema {
|
||||
fn hashmap_string_string(r#gen: &mut schemars::SchemaGenerator) -> schemars::Schema {
|
||||
type Type = HashMap<String, String>;
|
||||
<Type as schemars::JsonSchema>::json_schema(gen)
|
||||
<Type as schemars::JsonSchema>::json_schema(r#gen)
|
||||
}
|
||||
|
||||
#[cfg(feature = "unstable-schema")]
|
||||
fn hashmap_string_t<T: schemars::JsonSchema>(
|
||||
gen: &mut schemars::SchemaGenerator,
|
||||
r#gen: &mut schemars::SchemaGenerator,
|
||||
) -> schemars::Schema {
|
||||
type Type<T> = HashMap<String, T>;
|
||||
<Type<T> as schemars::JsonSchema>::json_schema(gen)
|
||||
<Type<T> as schemars::JsonSchema>::json_schema(r#gen)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
@@ -250,7 +250,7 @@ impl<'i, 'w, D: typos::Dictionary> Override<'i, 'w, D> {
|
||||
|
||||
fn interpret<'z, I: Iterator<Item = (&'z str, &'z str)>>(
|
||||
cases: I,
|
||||
) -> impl Iterator<Item = (&'z str, Status<'z>)> {
|
||||
) -> impl Iterator<Item = (&'z str, Status<'z>)> + use<'z, I, D> {
|
||||
cases.map(|(typo, correction)| {
|
||||
let correction = if typo == correction {
|
||||
Status::Valid
|
||||
|
||||
@@ -751,7 +751,7 @@ impl<'t> Identifier<'t> {
|
||||
|
||||
/// Split into individual Words.
|
||||
#[inline]
|
||||
pub fn split(&self) -> impl Iterator<Item = Word<'t>> {
|
||||
pub fn split(&self) -> impl Iterator<Item = Word<'t>> + use<'t> {
|
||||
match self.case {
|
||||
Case::None => itertools::Either::Left(SplitIdent::new(self.token, self.offset)),
|
||||
_ => itertools::Either::Right(
|
||||
|
||||
Reference in New Issue
Block a user