@@ -14,6 +14,7 @@ use crate::formatting::{ReportedErrors, SourceFile};
14
14
use crate :: rustfmt_diff:: { make_diff, print_diff, DiffLine , Mismatch , ModifiedChunk , OutputWriter } ;
15
15
use crate :: source_file;
16
16
use crate :: { FormatReport , FormatReportFormatterBuilder , Input , Session } ;
17
+ use crate :: is_nightly_channel;
17
18
18
19
const DIFF_CONTEXT_SIZE : usize = 3 ;
19
20
const CONFIGURATIONS_FILE_NAME : & str = "Configurations.md" ;
@@ -260,7 +261,7 @@ fn assert_output(source: &Path, expected_filename: &Path) {
260
261
fn idempotence_tests ( ) {
261
262
run_test_with ( & TestSetting :: default ( ) , || {
262
263
// these tests require nightly
263
- if !is_nightly ( ) {
264
+ if !is_nightly_channel ! ( ) {
264
265
return ;
265
266
}
266
267
// Get all files in the tests/target directory.
@@ -278,7 +279,7 @@ fn idempotence_tests() {
278
279
#[ test]
279
280
fn self_tests ( ) {
280
281
// Issue-3443: these tests require nightly
281
- if !is_nightly ( ) {
282
+ if !is_nightly_channel ! ( ) {
282
283
return ;
283
284
}
284
285
let mut files = get_test_files ( Path :: new ( "tests" ) , false ) ;
@@ -313,11 +314,6 @@ fn self_tests() {
313
314
) ;
314
315
}
315
316
316
- fn is_nightly ( ) -> bool {
317
- let release_channel = option_env ! ( "CFG_RELEASE_CHANNEL" ) ;
318
- release_channel. is_none ( ) || release_channel == Some ( "nightly" )
319
- }
320
-
321
317
#[ test]
322
318
fn stdin_formatting_smoke_test ( ) {
323
319
let input = Input :: Text ( "fn main () {}" . to_owned ( ) ) ;
@@ -432,7 +428,7 @@ fn check_files(files: Vec<PathBuf>, opt_config: &Option<PathBuf>) -> (Vec<Format
432
428
433
429
for file_name in files {
434
430
let sig_comments = read_significant_comments ( & file_name) ;
435
- if sig_comments. contains_key ( "unstable" ) && !is_nightly ( ) {
431
+ if sig_comments. contains_key ( "unstable" ) && !is_nightly_channel ! ( ) {
436
432
debug ! (
437
433
"Skipping '{}' because it requires unstable \
438
434
features which are only available on nightly...",
0 commit comments