@@ -66,18 +66,12 @@ impl DiskImageBuilder {
6666
6767 /// Add or replace a kernel to be included in the final image.
6868 pub fn set_kernel ( & mut self , path : PathBuf ) -> & mut Self {
69- self . set_file_source (
70- KERNEL_FILE_NAME . into ( ) ,
71- FileDataSource :: File ( path. to_path_buf ( ) ) ,
72- )
69+ self . set_file_source ( KERNEL_FILE_NAME . into ( ) , FileDataSource :: File ( path) )
7370 }
7471
7572 /// Add or replace a ramdisk to be included in the final image.
7673 pub fn set_ramdisk ( & mut self , path : PathBuf ) -> & mut Self {
77- self . set_file_source (
78- RAMDISK_FILE_NAME . into ( ) ,
79- FileDataSource :: File ( path. to_path_buf ( ) ) ,
80- )
74+ self . set_file_source ( RAMDISK_FILE_NAME . into ( ) , FileDataSource :: File ( path) )
8175 }
8276
8377 /// Configures the runtime behavior of the bootloader.
@@ -98,7 +92,7 @@ impl DiskImageBuilder {
9892 ///
9993 /// Note that the bootloader only loads the kernel and ramdisk files into memory on boot.
10094 /// Other files need to be loaded manually by the kernel.
101- pub fn set_file ( & mut self , destination : & str , file_path : PathBuf ) -> & mut Self {
95+ pub fn set_file ( & mut self , destination : String , file_path : PathBuf ) -> & mut Self {
10296 self . set_file_source ( destination. into ( ) , FileDataSource :: File ( file_path) )
10397 }
10498
@@ -212,11 +206,11 @@ impl DiskImageBuilder {
212206 let mut local_map: BTreeMap < & str , _ > = BTreeMap :: new ( ) ;
213207
214208 for ( name, source) in & self . files {
215- local_map. insert ( & name, source) ;
209+ local_map. insert ( name, source) ;
216210 }
217211
218- for k in internal_files {
219- if local_map. insert ( k. 0 , & k. 1 ) . is_some ( ) {
212+ for k in & internal_files {
213+ if local_map. insert ( k. 0 , k. 1 ) . is_some ( ) {
220214 return Err ( anyhow:: Error :: msg ( format ! (
221215 "Attempted to overwrite internal file: {}" ,
222216 k. 0
0 commit comments