Skip to content

Commit c28df19

Browse files
authored
Merge pull request #1411 from epage/edition2024
chore: Migrate to 2024 edition
2 parents eb91395 + 7849fba commit c28df19

File tree

11 files changed

+35
-35
lines changed

11 files changed

+35
-35
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ resolver = "2"
88
[workspace.package]
99
repository = "https://github.com/crate-ci/typos"
1010
license = "MIT OR Apache-2.0"
11-
edition = "2021"
12-
rust-version = "1.80" # MSRV
11+
edition = "2024"
12+
rust-version = "1.87" # MSRV
1313
include = [
1414
"build.rs",
1515
"src/**/*",

crates/dictgen/src/aho_corasick.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ pub use ::aho_corasick::StartKind;
88

99
#[cfg(feature = "codegen")]
1010
pub struct AhoCorasickGen<'g> {
11-
pub(crate) gen: crate::DictGen<'g>,
11+
pub(crate) r#gen: crate::DictGen<'g>,
1212
}
1313

1414
#[cfg(feature = "codegen")]
@@ -21,8 +21,8 @@ impl AhoCorasickGen<'_> {
2121
let mut data: Vec<_> = data.collect();
2222
data.sort_unstable_by_key(|v| unicase::UniCase::new(v.0.as_ref().to_owned()));
2323

24-
let name = self.gen.name;
25-
let value_type = self.gen.value_type;
24+
let name = self.r#gen.name;
25+
let value_type = self.r#gen.value_type;
2626

2727
writeln!(file, "pub struct {name} {{")?;
2828
writeln!(file, " dfa: dictgen::aho_corasick::DFA,")?;

crates/dictgen/src/gen.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,34 +37,34 @@ impl<'g> DictGen<'g> {
3737
#[cfg(feature = "map")]
3838
pub fn map(self) -> crate::MapGen<'g> {
3939
crate::MapGen {
40-
gen: self,
40+
r#gen: self,
4141
unicode: true,
4242
unicase: true,
4343
}
4444
}
4545

4646
pub fn ordered_map(self) -> crate::OrderedMapGen<'g> {
4747
crate::OrderedMapGen {
48-
gen: self,
48+
r#gen: self,
4949
unicode: true,
5050
unicase: true,
5151
}
5252
}
5353

5454
pub fn trie(self) -> crate::TrieGen<'g> {
5555
crate::TrieGen {
56-
gen: self,
56+
r#gen: self,
5757
limit: 64,
5858
}
5959
}
6060

6161
pub fn r#match(self) -> crate::MatchGen<'g> {
62-
crate::MatchGen { gen: self }
62+
crate::MatchGen { r#gen: self }
6363
}
6464

6565
#[cfg(feature = "aho-corasick")]
6666
pub fn aho_corasick(self) -> crate::AhoCorasickGen<'g> {
67-
crate::AhoCorasickGen { gen: self }
67+
crate::AhoCorasickGen { r#gen: self }
6868
}
6969
}
7070

crates/dictgen/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#[cfg(feature = "aho-corasick")]
66
pub mod aho_corasick;
77
#[cfg(feature = "codegen")]
8-
mod gen;
8+
mod r#gen;
99
mod insensitive;
1010
#[cfg(feature = "map")]
1111
mod map;
@@ -17,12 +17,12 @@ mod trie;
1717
#[cfg(feature = "aho-corasick")]
1818
#[cfg(feature = "codegen")]
1919
pub use aho_corasick::AhoCorasickGen;
20-
#[cfg(feature = "codegen")]
21-
pub use gen::*;
2220
pub use insensitive::*;
2321
#[cfg(feature = "map")]
2422
pub use map::*;
2523
pub use ordered_map::*;
2624
#[cfg(feature = "codegen")]
25+
pub use r#gen::*;
26+
#[cfg(feature = "codegen")]
2727
pub use r#match::*;
2828
pub use trie::*;

crates/dictgen/src/map.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#[cfg(feature = "codegen")]
22
pub struct MapGen<'g> {
3-
pub(crate) gen: crate::DictGen<'g>,
3+
pub(crate) r#gen: crate::DictGen<'g>,
44
pub(crate) unicase: bool,
55
pub(crate) unicode: bool,
66
}
@@ -25,9 +25,9 @@ impl MapGen<'_> {
2525
let mut data: Vec<_> = data.collect();
2626
data.sort_unstable_by_key(|v| unicase::UniCase::new(v.0.as_ref().to_owned()));
2727

28-
let name = self.gen.name;
28+
let name = self.r#gen.name;
2929
let key_type = self.key_type();
30-
let value_type = self.gen.value_type;
30+
let value_type = self.r#gen.value_type;
3131

3232
let mut smallest = usize::MAX;
3333
let mut largest = usize::MIN;

crates/dictgen/src/match.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#[cfg(feature = "codegen")]
22
pub struct MatchGen<'g> {
3-
pub(crate) gen: crate::DictGen<'g>,
3+
pub(crate) r#gen: crate::DictGen<'g>,
44
}
55

66
#[cfg(feature = "codegen")]
@@ -13,8 +13,8 @@ impl MatchGen<'_> {
1313
let mut data: Vec<_> = data.collect();
1414
data.sort_unstable_by_key(|v| unicase::UniCase::new(v.0.as_ref().to_owned()));
1515

16-
let name = self.gen.name;
17-
let value_type = self.gen.value_type;
16+
let name = self.r#gen.name;
17+
let value_type = self.r#gen.value_type;
1818

1919
writeln!(file, "pub struct {name};")?;
2020
writeln!(file, "impl {name} {{")?;

crates/dictgen/src/ordered_map.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#[cfg(feature = "codegen")]
22
pub struct OrderedMapGen<'g> {
3-
pub(crate) gen: crate::DictGen<'g>,
3+
pub(crate) r#gen: crate::DictGen<'g>,
44
pub(crate) unicase: bool,
55
pub(crate) unicode: bool,
66
}
@@ -25,9 +25,9 @@ impl OrderedMapGen<'_> {
2525
let mut data: Vec<_> = data.collect();
2626
data.sort_unstable_by_key(|v| unicase::UniCase::new(v.0.as_ref().to_owned()));
2727

28-
let name = self.gen.name;
28+
let name = self.r#gen.name;
2929
let key_type = self.key_type();
30-
let value_type = self.gen.value_type;
30+
let value_type = self.r#gen.value_type;
3131

3232
let mut smallest = usize::MAX;
3333
let mut largest = usize::MIN;

crates/dictgen/src/trie.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#[cfg(feature = "codegen")]
22
pub struct TrieGen<'g> {
3-
pub(crate) gen: crate::DictGen<'g>,
3+
pub(crate) r#gen: crate::DictGen<'g>,
44
pub(crate) limit: usize,
55
}
66

@@ -19,8 +19,8 @@ impl TrieGen<'_> {
1919
file: &mut W,
2020
data: impl Iterator<Item = (&'d str, V)>,
2121
) -> Result<(), std::io::Error> {
22-
let name = self.gen.name;
23-
let value_type = self.gen.value_type;
22+
let name = self.r#gen.name;
23+
let value_type = self.r#gen.value_type;
2424
codegen::generate_trie(file, name, value_type, data, self.limit)
2525
}
2626
}
@@ -310,7 +310,7 @@ mod codegen {
310310
DynChild::Nested(_) => {
311311
unreachable!("Only overflow at this point")
312312
}
313-
DynChild::Flat(ref mut v) => {
313+
DynChild::Flat(v) => {
314314
v.push((remaining, value));
315315
}
316316
}

crates/typos-cli/src/config.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ impl TypeEngineConfig {
317317
}
318318
}
319319

320-
pub fn patterns(&self) -> impl Iterator<Item = (KString, GlobEngineConfig)> {
320+
pub fn patterns(&self) -> impl Iterator<Item = (KString, GlobEngineConfig)> + use<> {
321321
let mut engine = Self::from_defaults();
322322
engine.update(self);
323323
engine.patterns.into_iter()
@@ -619,23 +619,23 @@ impl std::fmt::Display for Locale {
619619
}
620620

621621
#[cfg(feature = "unstable-schema")]
622-
fn vec_string(gen: &mut schemars::SchemaGenerator) -> schemars::Schema {
622+
fn vec_string(r#gen: &mut schemars::SchemaGenerator) -> schemars::Schema {
623623
type Type = Vec<String>;
624-
<Type as schemars::JsonSchema>::json_schema(gen)
624+
<Type as schemars::JsonSchema>::json_schema(r#gen)
625625
}
626626

627627
#[cfg(feature = "unstable-schema")]
628-
fn hashmap_string_string(gen: &mut schemars::SchemaGenerator) -> schemars::Schema {
628+
fn hashmap_string_string(r#gen: &mut schemars::SchemaGenerator) -> schemars::Schema {
629629
type Type = HashMap<String, String>;
630-
<Type as schemars::JsonSchema>::json_schema(gen)
630+
<Type as schemars::JsonSchema>::json_schema(r#gen)
631631
}
632632

633633
#[cfg(feature = "unstable-schema")]
634634
fn hashmap_string_t<T: schemars::JsonSchema>(
635-
gen: &mut schemars::SchemaGenerator,
635+
r#gen: &mut schemars::SchemaGenerator,
636636
) -> schemars::Schema {
637637
type Type<T> = HashMap<String, T>;
638-
<Type<T> as schemars::JsonSchema>::json_schema(gen)
638+
<Type<T> as schemars::JsonSchema>::json_schema(r#gen)
639639
}
640640

641641
#[cfg(test)]

crates/typos-cli/src/dict.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ impl<'i, 'w, D: typos::Dictionary> Override<'i, 'w, D> {
250250

251251
fn interpret<'z, I: Iterator<Item = (&'z str, &'z str)>>(
252252
cases: I,
253-
) -> impl Iterator<Item = (&'z str, Status<'z>)> {
253+
) -> impl Iterator<Item = (&'z str, Status<'z>)> + use<'z, I, D> {
254254
cases.map(|(typo, correction)| {
255255
let correction = if typo == correction {
256256
Status::Valid

0 commit comments

Comments
 (0)