@@ -355,7 +355,7 @@ impl<'a> TomlTweaker<'a> {
355
355
356
356
pub fn save ( self , output_file : & Path ) -> Result < ( ) , Error > {
357
357
let crate_name = self . krate . to_string ( ) ;
358
- :: std:: fs:: write ( output_file, Value :: Table ( self . table ) . to_string ( ) . as_bytes ( ) ) ?;
358
+ :: std:: fs:: write ( output_file, toml :: to_string ( & self . table ) ? . as_bytes ( ) ) ?;
359
359
info ! (
360
360
"tweaked toml for {} written to {}" ,
361
361
crate_name,
@@ -393,7 +393,7 @@ mod tests {
393
393
use super :: TomlTweaker ;
394
394
use crate :: build:: { CratePatch , GitCratePatch , PathCratePatch } ;
395
395
use crate :: crates:: Crate ;
396
- use toml:: { self , Value } ;
396
+ use toml:: toml ;
397
397
398
398
#[ test]
399
399
fn test_tweak_table_noop ( ) {
@@ -409,11 +409,10 @@ mod tests {
409
409
410
410
let krate = Crate :: local ( "/dev/null" . as_ref ( ) ) ;
411
411
let patches: Vec < CratePatch > = Vec :: new ( ) ;
412
- let mut tweaker =
413
- TomlTweaker :: new_with_table ( & krate, toml. as_table ( ) . unwrap ( ) . clone ( ) , & patches) ;
412
+ let mut tweaker = TomlTweaker :: new_with_table ( & krate, toml, & patches) ;
414
413
tweaker. tweak ( ) ;
415
414
416
- assert_eq ! ( Value :: Table ( tweaker. table) , result) ;
415
+ assert_eq ! ( tweaker. table, result) ;
417
416
}
418
417
419
418
#[ test]
@@ -445,11 +444,10 @@ mod tests {
445
444
446
445
let krate = Crate :: local ( "/dev/null" . as_ref ( ) ) ;
447
446
let patches: Vec < CratePatch > = Vec :: new ( ) ;
448
- let mut tweaker =
449
- TomlTweaker :: new_with_table ( & krate, toml. as_table ( ) . unwrap ( ) . clone ( ) , & patches) ;
447
+ let mut tweaker = TomlTweaker :: new_with_table ( & krate, toml, & patches) ;
450
448
tweaker. tweak ( ) ;
451
449
452
- assert_eq ! ( Value :: Table ( tweaker. table) , result) ;
450
+ assert_eq ! ( tweaker. table, result) ;
453
451
}
454
452
455
453
#[ test]
@@ -504,10 +502,9 @@ mod tests {
504
502
path: "/path/to/baz" . into( ) ,
505
503
} ) ,
506
504
] ;
507
- let mut tweaker =
508
- TomlTweaker :: new_with_table ( & krate, toml. as_table ( ) . unwrap ( ) . clone ( ) , & patches) ;
505
+ let mut tweaker = TomlTweaker :: new_with_table ( & krate, toml, & patches) ;
509
506
tweaker. tweak ( ) ;
510
507
511
- assert_eq ! ( Value :: Table ( tweaker. table) , result) ;
508
+ assert_eq ! ( tweaker. table, result) ;
512
509
}
513
510
}
0 commit comments