@@ -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    } 
@@ -591,19 +589,10 @@ fn merge_profile(profile: &mut Profile, toml: &TomlProfile) {
591589        profile. incremental  = incremental; 
592590    } 
593591    profile. strip  = match  toml. strip  { 
594-         Some ( StringOrBool :: Bool ( enabled) )  if  enabled => Strip :: Symbols , 
595-         Some ( StringOrBool :: Bool ( enabled) )  if  !enabled => Strip :: None , 
596-         Some ( StringOrBool :: String ( ref  n) )  if  matches ! ( n. as_str( ) ,  "off"  | "n"  | "no"  | "none" )  => { 
597-             Strip :: None 
598-         } 
599-         Some ( StringOrBool :: String ( ref  n) )  if  matches ! ( n. as_str( ) ,  "debuginfo" )  => Strip :: DebugInfo , 
600-         Some ( StringOrBool :: String ( ref  n) )  if  matches ! ( n. as_str( ) ,  "symbols" )  => Strip :: Symbols , 
601-         None  => Strip :: None , 
602-         Some ( ref  strip)  => panic ! ( 
603-             "unknown variant `{}`, expected one of `debuginfo`, `none`, `symbols` for key `strip` 
604-             " , 
605-             strip
606-         ) , 
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) ) , 
607596    } ; 
608597} 
609598
@@ -821,24 +810,22 @@ impl fmt::Display for PanicStrategy {
821810) ] 
822811#[ serde( rename_all = "lowercase" ) ]  
823812pub  enum  Strip  { 
824-     /// Only strip debugging symbols 
825-      DebugInfo , 
826813    /// Don't remove any symbols 
827814     None , 
828-     /// Strip all non-exported symbols from the final binary  
829-      Symbols , 
815+     /// Named  Strip settings  
816+      Named ( InternedString ) , 
830817} 
831818
832819impl  fmt:: Display  for  Strip  { 
833820    fn  fmt ( & self ,  f :  & mut  fmt:: Formatter < ' _ > )  -> fmt:: Result  { 
834821        match  * self  { 
835-             Strip :: DebugInfo  => "debuginfo" , 
836822            Strip :: None  => "none" , 
837-             Strip :: Symbols  => "symbols" , 
823+             Strip :: Named ( s )  => s . as_str ( ) , 
838824        } 
839825        . fmt ( f) 
840826    } 
841827} 
828+ 
842829/// Flags used in creating `Unit`s to indicate the purpose for the target, and 
843830/// to ensure the target's dependencies have the correct settings. 
844831#[ derive( Copy ,  Clone ,  Debug ,  Eq ,  PartialEq ,  Hash ,  Ord ,  PartialOrd ) ]  
@@ -1261,3 +1248,8 @@ fn validate_packages_unmatched(
12611248    } 
12621249    Ok ( ( ) ) 
12631250} 
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