@@ -93,7 +93,7 @@ impl Profiles {
93
93
// Merge with predefined profiles.
94
94
use std:: collections:: btree_map:: Entry ;
95
95
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 ( ) ) {
97
97
Entry :: Vacant ( vac) => {
98
98
vac. insert ( predef_prof) ;
99
99
}
@@ -119,9 +119,9 @@ impl Profiles {
119
119
/// Returns the hard-coded directory names for built-in profiles.
120
120
fn predefined_dir_names ( ) -> HashMap < InternedString , InternedString > {
121
121
[
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 ( ) ) ,
125
125
]
126
126
. into ( )
127
127
}
@@ -134,12 +134,12 @@ impl Profiles {
134
134
trim_paths_enabled : bool ,
135
135
) {
136
136
profile_makers. by_name . insert (
137
- InternedString :: new ( "dev" ) ,
137
+ "dev" . into ( ) ,
138
138
ProfileMaker :: new ( Profile :: default_dev ( ) , profiles. get ( "dev" ) . cloned ( ) ) ,
139
139
) ;
140
140
141
141
profile_makers. by_name . insert (
142
- InternedString :: new ( "release" ) ,
142
+ "release" . into ( ) ,
143
143
ProfileMaker :: new (
144
144
Profile :: default_release ( trim_paths_enabled) ,
145
145
profiles. get ( "release" ) . cloned ( ) ,
@@ -185,7 +185,7 @@ impl Profiles {
185
185
match & profile. dir_name {
186
186
None => { }
187
187
Some ( dir_name) => {
188
- self . dir_names . insert ( name, InternedString :: new ( dir_name) ) ;
188
+ self . dir_names . insert ( name, dir_name. into ( ) ) ;
189
189
}
190
190
}
191
191
@@ -230,7 +230,7 @@ impl Profiles {
230
230
self . get_profile_maker ( & inherits_name) . unwrap ( ) . clone ( )
231
231
}
232
232
Some ( inherits_name) => {
233
- let inherits_name = InternedString :: new ( & inherits_name) ;
233
+ let inherits_name = inherits_name. into ( ) ;
234
234
if !set. insert ( inherits_name) {
235
235
bail ! (
236
236
"profile inheritance loop detected with profile `{}` inheriting `{}`" ,
@@ -297,7 +297,7 @@ impl Profiles {
297
297
CompileKind :: Target ( target) => target. short_name ( ) ,
298
298
} ;
299
299
if target. contains ( "-apple-" ) {
300
- profile. split_debuginfo = Some ( InternedString :: new ( "unpacked" ) ) ;
300
+ profile. split_debuginfo = Some ( "unpacked" . into ( ) ) ;
301
301
}
302
302
}
303
303
@@ -455,7 +455,7 @@ impl ProfileMaker {
455
455
// basically turning down the optimization level and avoid limiting
456
456
// codegen units. This ensures that we spend little time optimizing as
457
457
// well as enabling parallelism by not constraining codegen units.
458
- profile. opt_level = InternedString :: new ( "0" ) ;
458
+ profile. opt_level = "0" . into ( ) ;
459
459
profile. codegen_units = None ;
460
460
461
461
// For build dependencies, we usually don't need debuginfo, and
@@ -531,12 +531,12 @@ fn merge_toml_overrides(
531
531
/// Does not merge overrides (see `merge_toml_overrides`).
532
532
fn merge_profile ( profile : & mut Profile , toml : & TomlProfile ) {
533
533
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 ( ) ;
535
535
}
536
536
match toml. lto {
537
537
Some ( StringOrBool :: Bool ( b) ) => profile. lto = Lto :: Bool ( b) ,
538
538
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 ( ) ) ,
540
540
None => { }
541
541
}
542
542
if toml. codegen_backend . is_some ( ) {
@@ -552,7 +552,7 @@ fn merge_profile(profile: &mut Profile, toml: &TomlProfile) {
552
552
profile. debug_assertions = debug_assertions;
553
553
}
554
554
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 ( ) ) ;
556
556
}
557
557
if let Some ( rpath) = toml. rpath {
558
558
profile. rpath = rpath;
@@ -578,16 +578,12 @@ fn merge_profile(profile: &mut Profile, toml: &TomlProfile) {
578
578
profile. trim_paths = Some ( trim_paths. clone ( ) ) ;
579
579
}
580
580
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 ( ) ) ) ,
584
582
Some ( StringOrBool :: Bool ( false ) ) => Strip :: Resolved ( StripInner :: None ) ,
585
583
Some ( StringOrBool :: String ( ref n) ) if n. as_str ( ) == "none" => {
586
584
Strip :: Resolved ( StripInner :: None )
587
585
}
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 ( ) ) ) ,
591
587
None => Strip :: Deferred ( StripInner :: None ) ,
592
588
} ;
593
589
}
@@ -635,8 +631,8 @@ pub struct Profile {
635
631
impl Default for Profile {
636
632
fn default ( ) -> Profile {
637
633
Profile {
638
- name : InternedString :: new ( "" ) ,
639
- opt_level : InternedString :: new ( "0" ) ,
634
+ name : "" . into ( ) ,
635
+ opt_level : "0" . into ( ) ,
640
636
root : ProfileRoot :: Debug ,
641
637
lto : Lto :: Bool ( false ) ,
642
638
codegen_backend : None ,
@@ -710,7 +706,7 @@ impl Profile {
710
706
/// Returns a built-in `dev` profile.
711
707
fn default_dev ( ) -> Profile {
712
708
Profile {
713
- name : InternedString :: new ( "dev" ) ,
709
+ name : "dev" . into ( ) ,
714
710
root : ProfileRoot :: Debug ,
715
711
debuginfo : DebugInfo :: Resolved ( TomlDebugInfo :: Full ) ,
716
712
debug_assertions : true ,
@@ -724,9 +720,9 @@ impl Profile {
724
720
fn default_release ( trim_paths_enabled : bool ) -> Profile {
725
721
let trim_paths = trim_paths_enabled. then ( || TomlTrimPathsValue :: Object . into ( ) ) ;
726
722
Profile {
727
- name : InternedString :: new ( "release" ) ,
723
+ name : "release" . into ( ) ,
728
724
root : ProfileRoot :: Release ,
729
- opt_level : InternedString :: new ( "3" ) ,
725
+ opt_level : "3" . into ( ) ,
730
726
trim_paths,
731
727
..Profile :: default ( )
732
728
}
@@ -1274,13 +1270,13 @@ fn merge_config_profiles(
1274
1270
profile. merge ( & config_profile) ;
1275
1271
}
1276
1272
if let Some ( inherits) = & profile. inherits {
1277
- check_to_add. insert ( InternedString :: new ( inherits) ) ;
1273
+ check_to_add. insert ( inherits. into ( ) ) ;
1278
1274
}
1279
1275
}
1280
1276
// Add the built-in profiles. This is important for things like `cargo
1281
1277
// 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 ( ) ) ;
1284
1280
}
1285
1281
// Add config-only profiles.
1286
1282
// Need to iterate repeatedly to get all the inherits values.
@@ -1291,7 +1287,7 @@ fn merge_config_profiles(
1291
1287
if !profiles. contains_key ( name. as_str ( ) ) {
1292
1288
if let Some ( config_profile) = get_config_profile ( ws, & name) ? {
1293
1289
if let Some ( inherits) = & config_profile. inherits {
1294
- check_to_add. insert ( InternedString :: new ( inherits) ) ;
1290
+ check_to_add. insert ( inherits. into ( ) ) ;
1295
1291
}
1296
1292
profiles. insert ( name, config_profile) ;
1297
1293
}
0 commit comments