Skip to content

Commit ef6b583

Browse files
committed
Don't accept Edition by ref
1 parent 03158f4 commit ef6b583

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

compiler/rustc_span/src/edition.rs

+14-14
Original file line numberDiff line numberDiff line change
@@ -49,26 +49,26 @@ impl fmt::Display for Edition {
4949
}
5050

5151
impl Edition {
52-
pub fn lint_name(&self) -> &'static str {
53-
match *self {
52+
pub fn lint_name(self) -> &'static str {
53+
match self {
5454
Edition::Edition2015 => "rust_2015_compatibility",
5555
Edition::Edition2018 => "rust_2018_compatibility",
5656
Edition::Edition2021 => "rust_2021_compatibility",
5757
Edition::Edition2024 => "rust_2024_compatibility",
5858
}
5959
}
6060

61-
pub fn feature_name(&self) -> Symbol {
62-
match *self {
61+
pub fn feature_name(self) -> Symbol {
62+
match self {
6363
Edition::Edition2015 => sym::rust_2015_preview,
6464
Edition::Edition2018 => sym::rust_2018_preview,
6565
Edition::Edition2021 => sym::rust_2021_preview,
6666
Edition::Edition2024 => sym::rust_2024_preview,
6767
}
6868
}
6969

70-
pub fn is_stable(&self) -> bool {
71-
match *self {
70+
pub fn is_stable(self) -> bool {
71+
match self {
7272
Edition::Edition2015 => true,
7373
Edition::Edition2018 => true,
7474
Edition::Edition2021 => true,
@@ -77,23 +77,23 @@ impl Edition {
7777
}
7878

7979
/// Is this edition 2015?
80-
pub fn rust_2015(&self) -> bool {
81-
*self == Edition::Edition2015
80+
pub fn rust_2015(self) -> bool {
81+
self == Edition::Edition2015
8282
}
8383

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

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

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

0 commit comments

Comments
 (0)