File tree 2 files changed +6
-13
lines changed
2 files changed +6
-13
lines changed Original file line number Diff line number Diff line change @@ -194,11 +194,11 @@ pub fn config() -> Result<Option<Config>> {
194
194
}
195
195
}
196
196
197
- pub struct Profile {
198
- table : Value ,
197
+ pub struct Profile < ' t > {
198
+ table : & ' t Value ,
199
199
}
200
200
201
- impl Profile {
201
+ impl < ' t > Profile < ' t > {
202
202
pub fn hash < H > ( & self , hasher : & mut H )
203
203
where
204
204
H : Hasher ,
@@ -218,13 +218,9 @@ impl Profile {
218
218
219
219
v. to_string ( ) . hash ( hasher) ;
220
220
}
221
-
222
- pub fn set_lto ( & mut self ) {
223
- self . table . as_table_mut ( ) . expect ( "[profile.release] not a table" ) . insert ( "lto" . into ( ) , Value :: Boolean ( true ) ) ;
224
- }
225
221
}
226
222
227
- impl fmt:: Display for Profile {
223
+ impl < ' t > fmt:: Display for Profile < ' t > {
228
224
fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
229
225
let mut map = toml:: map:: Map :: new ( ) ;
230
226
map. insert ( "profile" . to_owned ( ) , {
@@ -247,7 +243,7 @@ impl Toml {
247
243
self . table
248
244
. get ( "profile" )
249
245
. and_then ( |v| v. get ( "release" ) )
250
- . map ( |t| Profile { table : t. clone ( ) } )
246
+ . map ( |t| Profile { table : t } )
251
247
}
252
248
}
253
249
Original file line number Diff line number Diff line change @@ -74,11 +74,8 @@ fn build_crate(
74
74
75
75
let target_dir = td. join ( "target" ) ;
76
76
77
- if let Some ( mut profile) = ctoml. profile ( ) {
78
- profile. set_lto ( ) ;
77
+ if let Some ( profile) = ctoml. profile ( ) {
79
78
stoml. push_str ( & profile. to_string ( ) )
80
- } else {
81
- stoml. push_str ( "[profile.release]\n lto = true" ) ;
82
79
}
83
80
84
81
util:: write ( & td. join ( "Cargo.toml" ) , & stoml) ?;
You can’t perform that action at this time.
0 commit comments