@@ -93,7 +93,7 @@ impl Profiles {
9393 // Merge with predefined profiles.
9494 use std:: collections:: btree_map:: Entry ;
9595 for ( predef_name, mut predef_prof) in Self :: predefined_profiles ( ) . into_iter ( ) {
96- match profiles. entry ( InternedString :: new ( predef_name) ) {
96+ match profiles. entry ( predef_name. into ( ) ) {
9797 Entry :: Vacant ( vac) => {
9898 vac. insert ( predef_prof) ;
9999 }
@@ -119,9 +119,9 @@ impl Profiles {
119119 /// Returns the hard-coded directory names for built-in profiles.
120120 fn predefined_dir_names ( ) -> HashMap < InternedString , InternedString > {
121121 [
122- ( InternedString :: new ( "dev" ) , InternedString :: new ( "debug" ) ) ,
123- ( InternedString :: new ( "test" ) , InternedString :: new ( "debug" ) ) ,
124- ( InternedString :: new ( "bench" ) , InternedString :: new ( "release" ) ) ,
122+ ( "dev" . into ( ) , "debug" . into ( ) ) ,
123+ ( "test" . into ( ) , "debug" . into ( ) ) ,
124+ ( "bench" . into ( ) , "release" . into ( ) ) ,
125125 ]
126126 . into ( )
127127 }
@@ -134,12 +134,12 @@ impl Profiles {
134134 trim_paths_enabled : bool ,
135135 ) {
136136 profile_makers. by_name . insert (
137- InternedString :: new ( "dev" ) ,
137+ "dev" . into ( ) ,
138138 ProfileMaker :: new ( Profile :: default_dev ( ) , profiles. get ( "dev" ) . cloned ( ) ) ,
139139 ) ;
140140
141141 profile_makers. by_name . insert (
142- InternedString :: new ( "release" ) ,
142+ "release" . into ( ) ,
143143 ProfileMaker :: new (
144144 Profile :: default_release ( trim_paths_enabled) ,
145145 profiles. get ( "release" ) . cloned ( ) ,
@@ -185,7 +185,7 @@ impl Profiles {
185185 match & profile. dir_name {
186186 None => { }
187187 Some ( dir_name) => {
188- self . dir_names . insert ( name, InternedString :: new ( dir_name) ) ;
188+ self . dir_names . insert ( name, dir_name. into ( ) ) ;
189189 }
190190 }
191191
@@ -230,7 +230,7 @@ impl Profiles {
230230 self . get_profile_maker ( & inherits_name) . unwrap ( ) . clone ( )
231231 }
232232 Some ( inherits_name) => {
233- let inherits_name = InternedString :: new ( & inherits_name) ;
233+ let inherits_name = inherits_name. into ( ) ;
234234 if !set. insert ( inherits_name) {
235235 bail ! (
236236 "profile inheritance loop detected with profile `{}` inheriting `{}`" ,
@@ -297,7 +297,7 @@ impl Profiles {
297297 CompileKind :: Target ( target) => target. short_name ( ) ,
298298 } ;
299299 if target. contains ( "-apple-" ) {
300- profile. split_debuginfo = Some ( InternedString :: new ( "unpacked" ) ) ;
300+ profile. split_debuginfo = Some ( "unpacked" . into ( ) ) ;
301301 }
302302 }
303303
@@ -455,7 +455,7 @@ impl ProfileMaker {
455455 // basically turning down the optimization level and avoid limiting
456456 // codegen units. This ensures that we spend little time optimizing as
457457 // well as enabling parallelism by not constraining codegen units.
458- profile. opt_level = InternedString :: new ( "0" ) ;
458+ profile. opt_level = "0" . into ( ) ;
459459 profile. codegen_units = None ;
460460
461461 // For build dependencies, we usually don't need debuginfo, and
@@ -531,12 +531,12 @@ fn merge_toml_overrides(
531531/// Does not merge overrides (see `merge_toml_overrides`).
532532fn merge_profile ( profile : & mut Profile , toml : & TomlProfile ) {
533533 if let Some ( ref opt_level) = toml. opt_level {
534- profile. opt_level = InternedString :: new ( & opt_level. 0 ) ;
534+ profile. opt_level = opt_level. 0 . as_str ( ) . into ( ) ;
535535 }
536536 match toml. lto {
537537 Some ( StringOrBool :: Bool ( b) ) => profile. lto = Lto :: Bool ( b) ,
538538 Some ( StringOrBool :: String ( ref n) ) if is_off ( n. as_str ( ) ) => profile. lto = Lto :: Off ,
539- Some ( StringOrBool :: String ( ref n) ) => profile. lto = Lto :: Named ( InternedString :: new ( n ) ) ,
539+ Some ( StringOrBool :: String ( ref n) ) => profile. lto = Lto :: Named ( n . into ( ) ) ,
540540 None => { }
541541 }
542542 if toml. codegen_backend . is_some ( ) {
@@ -552,7 +552,7 @@ fn merge_profile(profile: &mut Profile, toml: &TomlProfile) {
552552 profile. debug_assertions = debug_assertions;
553553 }
554554 if let Some ( split_debuginfo) = & toml. split_debuginfo {
555- profile. split_debuginfo = Some ( InternedString :: new ( split_debuginfo) ) ;
555+ profile. split_debuginfo = Some ( split_debuginfo. into ( ) ) ;
556556 }
557557 if let Some ( rpath) = toml. rpath {
558558 profile. rpath = rpath;
@@ -578,16 +578,12 @@ fn merge_profile(profile: &mut Profile, toml: &TomlProfile) {
578578 profile. trim_paths = Some ( trim_paths. clone ( ) ) ;
579579 }
580580 profile. strip = match toml. strip {
581- Some ( StringOrBool :: Bool ( true ) ) => {
582- Strip :: Resolved ( StripInner :: Named ( InternedString :: new ( "symbols" ) ) )
583- }
581+ Some ( StringOrBool :: Bool ( true ) ) => Strip :: Resolved ( StripInner :: Named ( "symbols" . into ( ) ) ) ,
584582 Some ( StringOrBool :: Bool ( false ) ) => Strip :: Resolved ( StripInner :: None ) ,
585583 Some ( StringOrBool :: String ( ref n) ) if n. as_str ( ) == "none" => {
586584 Strip :: Resolved ( StripInner :: None )
587585 }
588- Some ( StringOrBool :: String ( ref n) ) => {
589- Strip :: Resolved ( StripInner :: Named ( InternedString :: new ( n) ) )
590- }
586+ Some ( StringOrBool :: String ( ref n) ) => Strip :: Resolved ( StripInner :: Named ( n. into ( ) ) ) ,
591587 None => Strip :: Deferred ( StripInner :: None ) ,
592588 } ;
593589}
@@ -635,8 +631,8 @@ pub struct Profile {
635631impl Default for Profile {
636632 fn default ( ) -> Profile {
637633 Profile {
638- name : InternedString :: new ( "" ) ,
639- opt_level : InternedString :: new ( "0" ) ,
634+ name : "" . into ( ) ,
635+ opt_level : "0" . into ( ) ,
640636 root : ProfileRoot :: Debug ,
641637 lto : Lto :: Bool ( false ) ,
642638 codegen_backend : None ,
@@ -710,7 +706,7 @@ impl Profile {
710706 /// Returns a built-in `dev` profile.
711707 fn default_dev ( ) -> Profile {
712708 Profile {
713- name : InternedString :: new ( "dev" ) ,
709+ name : "dev" . into ( ) ,
714710 root : ProfileRoot :: Debug ,
715711 debuginfo : DebugInfo :: Resolved ( TomlDebugInfo :: Full ) ,
716712 debug_assertions : true ,
@@ -724,9 +720,9 @@ impl Profile {
724720 fn default_release ( trim_paths_enabled : bool ) -> Profile {
725721 let trim_paths = trim_paths_enabled. then ( || TomlTrimPathsValue :: Object . into ( ) ) ;
726722 Profile {
727- name : InternedString :: new ( "release" ) ,
723+ name : "release" . into ( ) ,
728724 root : ProfileRoot :: Release ,
729- opt_level : InternedString :: new ( "3" ) ,
725+ opt_level : "3" . into ( ) ,
730726 trim_paths,
731727 ..Profile :: default ( )
732728 }
@@ -1274,13 +1270,13 @@ fn merge_config_profiles(
12741270 profile. merge ( & config_profile) ;
12751271 }
12761272 if let Some ( inherits) = & profile. inherits {
1277- check_to_add. insert ( InternedString :: new ( inherits) ) ;
1273+ check_to_add. insert ( inherits. into ( ) ) ;
12781274 }
12791275 }
12801276 // Add the built-in profiles. This is important for things like `cargo
12811277 // test` which implicitly use the "dev" profile for dependencies.
1282- for name in & [ "dev" , "release" , "test" , "bench" ] {
1283- check_to_add. insert ( InternedString :: new ( name) ) ;
1278+ for name in [ "dev" , "release" , "test" , "bench" ] {
1279+ check_to_add. insert ( name. into ( ) ) ;
12841280 }
12851281 // Add config-only profiles.
12861282 // Need to iterate repeatedly to get all the inherits values.
@@ -1291,7 +1287,7 @@ fn merge_config_profiles(
12911287 if !profiles. contains_key ( name. as_str ( ) ) {
12921288 if let Some ( config_profile) = get_config_profile ( ws, & name) ? {
12931289 if let Some ( inherits) = & config_profile. inherits {
1294- check_to_add. insert ( InternedString :: new ( inherits) ) ;
1290+ check_to_add. insert ( inherits. into ( ) ) ;
12951291 }
12961292 profiles. insert ( name, config_profile) ;
12971293 }
0 commit comments