Skip to content
This repository was archived by the owner on Dec 29, 2022. It is now read-only.

Commit 8825e14

Browse files
committed
Rephrase unstable features helper function
1 parent fc3448f commit 8825e14

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

rls/src/config.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,15 @@ impl<T> AsRef<T> for Inferrable<T> {
103103
}
104104
}
105105

106-
/// Returns whether RLS was built using nightly channel.
106+
/// Returns whether unstable features are allowed.
107107
///
108-
/// It is very similar to what rust and rustfmt uses [1] - it relies on
108+
/// It is very similar to what rustfmt uses [[1]] - it relies on
109109
/// CFG_RELEASE_CHANNEL being set by Rust bootstrap.
110110
/// In case the env var is missing, we assume that we're built by Cargo and are
111111
/// using nightly since that's the only channel supported right now.
112+
///
112113
/// [1]: https://github.com/rust-lang/rustfmt/blob/dfa94d150555da40780413d7f1a1378565208c99/src/config/config_type.rs#L53-L67
113-
pub fn is_nightly() -> bool {
114+
pub fn unstable_features_allowed() -> bool {
114115
option_env!("CFG_RELEASE_CHANNEL").map_or(true, |c| c == "nightly" || c == "dev")
115116
}
116117

@@ -262,7 +263,7 @@ impl Config {
262263
/// Ensures that unstable options are only allowed if `unstable_features` is
263264
/// true and that is not allowed on stable release channels.
264265
pub fn normalise(&mut self) {
265-
if !is_nightly() {
266+
if !unstable_features_allowed() {
266267
if self.unstable_features {
267268
eprintln!("`unstable_features` setting can only be used on nightly channel");
268269
}

0 commit comments

Comments
 (0)