From fd5774a4d7093bf65309fc69e23c57f298b94526 Mon Sep 17 00:00:00 2001 From: Maybe Waffle Date: Tue, 31 Jan 2023 09:50:56 +0000 Subject: Use `Edition` methods a bit more --- compiler/rustc_session/src/session.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'compiler/rustc_session/src') diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs index 95f199de6ff..1c8a2ea575f 100644 --- a/compiler/rustc_session/src/session.rs +++ b/compiler/rustc_session/src/session.rs @@ -900,22 +900,22 @@ impl Session { } pub fn rust_2015(&self) -> bool { - self.edition() == Edition::Edition2015 + self.edition().rust_2015() } /// Are we allowed to use features from the Rust 2018 edition? pub fn rust_2018(&self) -> bool { - self.edition() >= Edition::Edition2018 + self.edition().rust_2018() } /// Are we allowed to use features from the Rust 2021 edition? pub fn rust_2021(&self) -> bool { - self.edition() >= Edition::Edition2021 + self.edition().rust_2021() } /// Are we allowed to use features from the Rust 2024 edition? pub fn rust_2024(&self) -> bool { - self.edition() >= Edition::Edition2024 + self.edition().rust_2024() } /// Returns `true` if we cannot skip the PLT for shared library calls. -- cgit 1.4.1-3-g733a5 From 5d90413d753b7c6a2cdab5c1df58cf52a38de33c Mon Sep 17 00:00:00 2001 From: Maybe Waffle Date: Tue, 31 Jan 2023 09:52:54 +0000 Subject: Document `rust_2015` methods --- compiler/rustc_session/src/session.rs | 1 + compiler/rustc_span/src/edition.rs | 1 + 2 files changed, 2 insertions(+) (limited to 'compiler/rustc_session/src') diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs index 1c8a2ea575f..6b8c82fde71 100644 --- a/compiler/rustc_session/src/session.rs +++ b/compiler/rustc_session/src/session.rs @@ -899,6 +899,7 @@ impl Session { ret } + /// Is this edition 2015? pub fn rust_2015(&self) -> bool { self.edition().rust_2015() } diff --git a/compiler/rustc_span/src/edition.rs b/compiler/rustc_span/src/edition.rs index b43183916bc..db1cde985d3 100644 --- a/compiler/rustc_span/src/edition.rs +++ b/compiler/rustc_span/src/edition.rs @@ -76,6 +76,7 @@ impl Edition { } } + /// Is this edition 2015? pub fn rust_2015(&self) -> bool { *self == Edition::Edition2015 } -- cgit 1.4.1-3-g733a5