File tree 1 file changed +9
-15
lines changed
compiler/rustc_interface/src
1 file changed +9
-15
lines changed Original file line number Diff line number Diff line change @@ -482,27 +482,21 @@ fn categorize_crate_type(s: Symbol) -> Option<CrateType> {
482
482
}
483
483
484
484
pub fn collect_crate_types ( session : & Session , attrs : & [ ast:: Attribute ] ) -> Vec < CrateType > {
485
- // Unconditionally collect crate types from attributes to make them used
486
- let attr_types: Vec < CrateType > = attrs
487
- . iter ( )
488
- . filter_map ( |a| {
489
- if a. has_name ( sym:: crate_type) {
490
- match a. value_str ( ) {
491
- Some ( s) => categorize_crate_type ( s) ,
492
- _ => None ,
493
- }
494
- } else {
495
- None
496
- }
497
- } )
498
- . collect ( ) ;
499
-
500
485
// If we're generating a test executable, then ignore all other output
501
486
// styles at all other locations
502
487
if session. opts . test {
503
488
return vec ! [ CrateType :: Executable ] ;
504
489
}
505
490
491
+ // Unconditionally collect crate types from attributes to make them used
492
+ let attr_types = attrs. iter ( ) . filter_map ( |a| {
493
+ if a. has_name ( sym:: crate_type) && let Some ( s) = a. value_str ( ) {
494
+ categorize_crate_type ( s)
495
+ } else {
496
+ None
497
+ }
498
+ } ) ;
499
+
506
500
// Only check command line flags if present. If no types are specified by
507
501
// command line, then reuse the empty `base` Vec to hold the types that
508
502
// will be found in crate attributes.
You can’t perform that action at this time.
0 commit comments