Skip to content

Commit

Permalink
Don't accept Edition by ref
Browse files Browse the repository at this point in the history
  • Loading branch information
WaffleLapkin committed Jan 31, 2023
1 parent 03158f4 commit ef6b583
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions compiler/rustc_span/src/edition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,26 +49,26 @@ impl fmt::Display for Edition {
}

impl Edition {
pub fn lint_name(&self) -> &'static str {
match *self {
pub fn lint_name(self) -> &'static str {
match self {
Edition::Edition2015 => "rust_2015_compatibility",
Edition::Edition2018 => "rust_2018_compatibility",
Edition::Edition2021 => "rust_2021_compatibility",
Edition::Edition2024 => "rust_2024_compatibility",
}
}

pub fn feature_name(&self) -> Symbol {
match *self {
pub fn feature_name(self) -> Symbol {
match self {
Edition::Edition2015 => sym::rust_2015_preview,
Edition::Edition2018 => sym::rust_2018_preview,
Edition::Edition2021 => sym::rust_2021_preview,
Edition::Edition2024 => sym::rust_2024_preview,
}
}

pub fn is_stable(&self) -> bool {
match *self {
pub fn is_stable(self) -> bool {
match self {
Edition::Edition2015 => true,
Edition::Edition2018 => true,
Edition::Edition2021 => true,
Expand All @@ -77,23 +77,23 @@ impl Edition {
}

/// Is this edition 2015?
pub fn rust_2015(&self) -> bool {
*self == Edition::Edition2015
pub fn rust_2015(self) -> bool {
self == Edition::Edition2015
}

/// Are we allowed to use features from the Rust 2018 edition?
pub fn rust_2018(&self) -> bool {
*self >= Edition::Edition2018
pub fn rust_2018(self) -> bool {
self >= Edition::Edition2018
}

/// Are we allowed to use features from the Rust 2021 edition?
pub fn rust_2021(&self) -> bool {
*self >= Edition::Edition2021
pub fn rust_2021(self) -> bool {
self >= Edition::Edition2021
}

/// Are we allowed to use features from the Rust 2024 edition?
pub fn rust_2024(&self) -> bool {
*self >= Edition::Edition2024
pub fn rust_2024(self) -> bool {
self >= Edition::Edition2024
}
}

Expand Down

0 comments on commit ef6b583

Please sign in to comment.