Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/parser/src/edition.rs')
| -rw-r--r-- | crates/parser/src/edition.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/crates/parser/src/edition.rs b/crates/parser/src/edition.rs index 26178544f9..831a482059 100644 --- a/crates/parser/src/edition.rs +++ b/crates/parser/src/edition.rs @@ -12,8 +12,17 @@ pub enum Edition { } impl Edition { + /// The current latest stable edition, note this is usually not the right choice in code. pub const CURRENT: Edition = Edition::Edition2021; pub const DEFAULT: Edition = Edition::Edition2015; + + pub fn at_least_2024(self) -> bool { + self >= Edition::Edition2024 + } + + pub fn at_least_2018(self) -> bool { + self >= Edition::Edition2018 + } } #[derive(Debug)] |