@@ -552,9 +552,7 @@ fn merge_profile(profile: &mut Profile, toml: &TomlProfile) {
552552 }
553553 match toml. lto {
554554 Some ( StringOrBool :: Bool ( b) ) => profile. lto = Lto :: Bool ( b) ,
555- Some ( StringOrBool :: String ( ref n) ) if matches ! ( n. as_str( ) , "off" | "n" | "no" ) => {
556- profile. lto = Lto :: Off
557- }
555+ Some ( StringOrBool :: String ( ref n) ) if is_off ( n. as_str ( ) ) => profile. lto = Lto :: Off ,
558556 Some ( StringOrBool :: String ( ref n) ) => profile. lto = Lto :: Named ( InternedString :: new ( n) ) ,
559557 None => { }
560558 }
@@ -590,9 +588,12 @@ fn merge_profile(profile: &mut Profile, toml: &TomlProfile) {
590588 if let Some ( incremental) = toml. incremental {
591589 profile. incremental = incremental;
592590 }
593- if let Some ( strip) = toml. strip {
594- profile. strip = strip;
595- }
591+ profile. strip = match toml. strip {
592+ Some ( StringOrBool :: Bool ( true ) ) => Strip :: Named ( InternedString :: new ( "symbols" ) ) ,
593+ None | Some ( StringOrBool :: Bool ( false ) ) => Strip :: None ,
594+ Some ( StringOrBool :: String ( ref n) ) if is_off ( n. as_str ( ) ) => Strip :: None ,
595+ Some ( StringOrBool :: String ( ref n) ) => Strip :: Named ( InternedString :: new ( n) ) ,
596+ } ;
596597}
597598
598599/// The root profile (dev/release).
@@ -809,24 +810,22 @@ impl fmt::Display for PanicStrategy {
809810) ]
810811#[ serde( rename_all = "lowercase" ) ]
811812pub enum Strip {
812- /// Only strip debugging symbols
813- DebugInfo ,
814813 /// Don't remove any symbols
815814 None ,
816- /// Strip all non-exported symbols from the final binary
817- Symbols ,
815+ /// Named Strip settings
816+ Named ( InternedString ) ,
818817}
819818
820819impl fmt:: Display for Strip {
821820 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
822821 match * self {
823- Strip :: DebugInfo => "debuginfo" ,
824822 Strip :: None => "none" ,
825- Strip :: Symbols => "symbols" ,
823+ Strip :: Named ( s ) => s . as_str ( ) ,
826824 }
827825 . fmt ( f)
828826 }
829827}
828+
830829/// Flags used in creating `Unit`s to indicate the purpose for the target, and
831830/// to ensure the target's dependencies have the correct settings.
832831#[ derive( Copy , Clone , Debug , Eq , PartialEq , Hash , Ord , PartialOrd ) ]
@@ -1249,3 +1248,8 @@ fn validate_packages_unmatched(
12491248 }
12501249 Ok ( ( ) )
12511250}
1251+
1252+ /// Returns `true` if a string is a toggle that turns an option off.
1253+ fn is_off ( s : & str ) -> bool {
1254+ matches ! ( s, "off" | "n" | "no" | "none" )
1255+ }
0 commit comments