@@ -66,18 +66,12 @@ impl DiskImageBuilder {
66
66
67
67
/// Add or replace a kernel to be included in the final image.
68
68
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) )
73
70
}
74
71
75
72
/// Add or replace a ramdisk to be included in the final image.
76
73
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) )
81
75
}
82
76
83
77
/// Configures the runtime behavior of the bootloader.
@@ -98,7 +92,7 @@ impl DiskImageBuilder {
98
92
///
99
93
/// Note that the bootloader only loads the kernel and ramdisk files into memory on boot.
100
94
/// 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 {
102
96
self . set_file_source ( destination. into ( ) , FileDataSource :: File ( file_path) )
103
97
}
104
98
@@ -212,11 +206,11 @@ impl DiskImageBuilder {
212
206
let mut local_map: BTreeMap < & str , _ > = BTreeMap :: new ( ) ;
213
207
214
208
for ( name, source) in & self . files {
215
- local_map. insert ( & name, source) ;
209
+ local_map. insert ( name, source) ;
216
210
}
217
211
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 ( ) {
220
214
return Err ( anyhow:: Error :: msg ( format ! (
221
215
"Attempted to overwrite internal file: {}" ,
222
216
k. 0
0 commit comments