@@ -855,25 +855,19 @@ impl UnstableFeatures {
855
855
pub fn is_nightly_build ( & self ) -> bool {
856
856
match * self {
857
857
UnstableFeatures :: Allow | UnstableFeatures :: Cheat => true ,
858
- _ => false ,
858
+ UnstableFeatures :: Disallow => false ,
859
859
}
860
860
}
861
861
}
862
862
863
863
fn maybe_stage_features ( span_handler : & Handler , krate : & ast:: Crate , unstable : UnstableFeatures ) {
864
- let allow_features = match unstable {
865
- UnstableFeatures :: Allow => true ,
866
- UnstableFeatures :: Disallow => false ,
867
- UnstableFeatures :: Cheat => true
868
- } ;
869
- if !allow_features {
870
- for attr in & krate. attrs {
871
- if attr. check_name ( sym:: feature) {
872
- let release_channel = option_env ! ( "CFG_RELEASE_CHANNEL" ) . unwrap_or ( "(unknown)" ) ;
873
- span_err ! ( span_handler, attr. span, E0554 ,
874
- "`#![feature]` may not be used on the {} release channel" ,
875
- release_channel) ;
876
- }
864
+ if !unstable. is_nightly_build ( ) {
865
+ for attr in krate. attrs . iter ( ) . filter ( |attr| attr. check_name ( sym:: feature) ) {
866
+ span_err ! (
867
+ span_handler, attr. span, E0554 ,
868
+ "`#![feature]` may not be used on the {} release channel" ,
869
+ option_env!( "CFG_RELEASE_CHANNEL" ) . unwrap_or( "(unknown)" )
870
+ ) ;
877
871
}
878
872
}
879
873
}
0 commit comments