@@ -7,7 +7,6 @@ use crate::{
77 EFISdt32Tag , EFISdt64Tag , ElfSectionsTag , EndTag , FramebufferTag , ImageLoadPhysAddrTag ,
88 MemoryMapTag , ModuleTag , RsdpV1Tag , RsdpV2Tag , SmbiosTag , TagTrait , TagType , ALIGNMENT ,
99} ;
10- use alloc:: boxed:: Box ;
1110use alloc:: vec:: Vec ;
1211use core:: fmt:: { Display , Formatter } ;
1312use core:: mem:: size_of;
@@ -200,32 +199,32 @@ impl InformationBuilder {
200199
201200 /// Adds a 'basic memory information' tag (represented by [`BasicMemoryInfoTag`]) to the builder.
202201 #[ must_use]
203- pub fn basic_memory_info_tag ( self , tag : BasicMemoryInfoTag ) -> Self {
204- self . add_tag ( & tag) . unwrap ( )
202+ pub fn basic_memory_info_tag ( self , tag : & BasicMemoryInfoTag ) -> Self {
203+ self . add_tag ( tag) . unwrap ( )
205204 }
206205
207206 /// Adds a 'bootloader name' tag (represented by [`BootLoaderNameTag`]) to the builder.
208207 #[ must_use]
209- pub fn bootloader_name_tag ( self , tag : Box < BootLoaderNameTag > ) -> Self {
210- self . add_tag ( & * tag) . unwrap ( )
208+ pub fn bootloader_name_tag ( self , tag : & BootLoaderNameTag ) -> Self {
209+ self . add_tag ( tag) . unwrap ( )
211210 }
212211
213212 /// Adds a 'command line' tag (represented by [`CommandLineTag`]) to the builder.
214213 #[ must_use]
215- pub fn command_line_tag ( self , tag : Box < CommandLineTag > ) -> Self {
216- self . add_tag ( & * tag) . unwrap ( )
214+ pub fn command_line_tag ( self , tag : & CommandLineTag ) -> Self {
215+ self . add_tag ( tag) . unwrap ( )
217216 }
218217
219218 /// Adds a 'EFI 32-bit system table pointer' tag (represented by [`EFISdt32Tag`]) to the builder.
220219 #[ must_use]
221- pub fn efisdt32_tag ( self , tag : EFISdt32Tag ) -> Self {
222- self . add_tag ( & tag) . unwrap ( )
220+ pub fn efisdt32_tag ( self , tag : & EFISdt32Tag ) -> Self {
221+ self . add_tag ( tag) . unwrap ( )
223222 }
224223
225224 /// Adds a 'EFI 64-bit system table pointer' tag (represented by [`EFISdt64Tag`]) to the builder.
226225 #[ must_use]
227- pub fn efisdt64_tag ( self , tag : EFISdt64Tag ) -> Self {
228- self . add_tag ( & tag) . unwrap ( )
226+ pub fn efisdt64_tag ( self , tag : & EFISdt64Tag ) -> Self {
227+ self . add_tag ( tag) . unwrap ( )
229228 }
230229
231230 /// Adds a 'EFI boot services not terminated' tag (represented by [`EFIBootServicesNotExitedTag`]) to the builder.
@@ -236,69 +235,69 @@ impl InformationBuilder {
236235
237236 /// Adds a 'EFI 32-bit image handle pointer' tag (represented by [`EFIImageHandle32Tag`]) to the builder.
238237 #[ must_use]
239- pub fn efi_image_handle32 ( self , tag : EFIImageHandle32Tag ) -> Self {
240- self . add_tag ( & tag) . unwrap ( )
238+ pub fn efi_image_handle32 ( self , tag : & EFIImageHandle32Tag ) -> Self {
239+ self . add_tag ( tag) . unwrap ( )
241240 }
242241
243242 /// Adds a 'EFI 64-bit image handle pointer' tag (represented by [`EFIImageHandle64Tag`]) to the builder.
244243 #[ must_use]
245- pub fn efi_image_handle64 ( self , tag : EFIImageHandle64Tag ) -> Self {
246- self . add_tag ( & tag) . unwrap ( )
244+ pub fn efi_image_handle64 ( self , tag : & EFIImageHandle64Tag ) -> Self {
245+ self . add_tag ( tag) . unwrap ( )
247246 }
248247
249248 /// Adds a 'EFI Memory map' tag (represented by [`EFIMemoryMapTag`]) to the builder.
250249 #[ must_use]
251- pub fn efi_memory_map_tag ( self , tag : Box < EFIMemoryMapTag > ) -> Self {
252- self . add_tag ( & * tag) . unwrap ( )
250+ pub fn efi_memory_map_tag ( self , tag : & EFIMemoryMapTag ) -> Self {
251+ self . add_tag ( tag) . unwrap ( )
253252 }
254253
255254 /// Adds a 'ELF-Symbols' tag (represented by [`ElfSectionsTag`]) to the builder.
256255 #[ must_use]
257- pub fn elf_sections_tag ( self , tag : Box < ElfSectionsTag > ) -> Self {
258- self . add_tag ( & * tag) . unwrap ( )
256+ pub fn elf_sections_tag ( self , tag : & ElfSectionsTag ) -> Self {
257+ self . add_tag ( tag) . unwrap ( )
259258 }
260259
261260 /// Adds a 'Framebuffer info' tag (represented by [`FramebufferTag`]) to the builder.
262261 #[ must_use]
263- pub fn framebuffer_tag ( self , tag : Box < FramebufferTag > ) -> Self {
264- self . add_tag ( & * tag) . unwrap ( )
262+ pub fn framebuffer_tag ( self , tag : & FramebufferTag ) -> Self {
263+ self . add_tag ( tag) . unwrap ( )
265264 }
266265
267266 /// Adds a 'Image load base physical address' tag (represented by [`ImageLoadPhysAddrTag`]) to the builder.
268267 #[ must_use]
269- pub fn image_load_addr ( self , tag : ImageLoadPhysAddrTag ) -> Self {
270- self . add_tag ( & tag) . unwrap ( )
268+ pub fn image_load_addr ( self , tag : & ImageLoadPhysAddrTag ) -> Self {
269+ self . add_tag ( tag) . unwrap ( )
271270 }
272271
273272 /// Adds a (*none EFI*) 'memory map' tag (represented by [`MemoryMapTag`]) to the builder.
274273 #[ must_use]
275- pub fn memory_map_tag ( self , tag : Box < MemoryMapTag > ) -> Self {
276- self . add_tag ( & * tag) . unwrap ( )
274+ pub fn memory_map_tag ( self , tag : & MemoryMapTag ) -> Self {
275+ self . add_tag ( tag) . unwrap ( )
277276 }
278277
279278 /// Adds a 'Modules' tag (represented by [`ModuleTag`]) to the builder.
280279 /// This tag can occur multiple times in boot information.
281280 #[ must_use]
282- pub fn add_module_tag ( self , tag : Box < ModuleTag > ) -> Self {
283- self . add_tag ( & * tag) . unwrap ( )
281+ pub fn add_module_tag ( self , tag : & ModuleTag ) -> Self {
282+ self . add_tag ( tag) . unwrap ( )
284283 }
285284
286285 /// Adds a 'ACPI old RSDP' tag (represented by [`RsdpV1Tag`]) to the builder.
287286 #[ must_use]
288- pub fn rsdp_v1_tag ( self , tag : RsdpV1Tag ) -> Self {
289- self . add_tag ( & tag) . unwrap ( )
287+ pub fn rsdp_v1_tag ( self , tag : & RsdpV1Tag ) -> Self {
288+ self . add_tag ( tag) . unwrap ( )
290289 }
291290
292291 /// Adds a 'ACPI new RSDP' tag (represented by [`RsdpV2Tag`]) to the builder.
293292 #[ must_use]
294- pub fn rsdp_v2_tag ( self , tag : RsdpV2Tag ) -> Self {
295- self . add_tag ( & tag) . unwrap ( )
293+ pub fn rsdp_v2_tag ( self , tag : & RsdpV2Tag ) -> Self {
294+ self . add_tag ( tag) . unwrap ( )
296295 }
297296
298297 /// Adds a 'SMBIOS tables' tag (represented by [`SmbiosTag`]) to the builder.
299298 #[ must_use]
300- pub fn smbios_tag ( self , tag : Box < SmbiosTag > ) -> Self {
301- self . add_tag ( & * tag) . unwrap ( )
299+ pub fn smbios_tag ( self , tag : & SmbiosTag ) -> Self {
300+ self . add_tag ( tag) . unwrap ( )
302301 }
303302
304303 const fn tag_is_allowed_multiple_times ( tag_type : TagType ) -> bool {
@@ -322,18 +321,18 @@ mod tests {
322321 assert_eq ! ( builder. expected_len( ) , expected_len) ;
323322
324323 // the most simple tag
325- builder = builder. basic_memory_info_tag ( BasicMemoryInfoTag :: new ( 640 , 7 * 1024 ) ) ;
324+ builder = builder. basic_memory_info_tag ( & BasicMemoryInfoTag :: new ( 640 , 7 * 1024 ) ) ;
326325 expected_len += 16 ;
327326 assert_eq ! ( builder. expected_len( ) , expected_len) ;
328327 // a tag that has a dynamic size
329- builder = builder. command_line_tag ( CommandLineTag :: new ( "test" ) ) ;
328+ builder = builder. command_line_tag ( & CommandLineTag :: new ( "test" ) ) ;
330329 expected_len += 8 + 5 + 3 ; // padding
331330 assert_eq ! ( builder. expected_len( ) , expected_len) ;
332331 // many modules
333- builder = builder. add_module_tag ( ModuleTag :: new ( 0 , 1234 , "module1" ) ) ;
332+ builder = builder. add_module_tag ( & ModuleTag :: new ( 0 , 1234 , "module1" ) ) ;
334333 expected_len += 16 + 8 ;
335334 assert_eq ! ( builder. expected_len( ) , expected_len) ;
336- builder = builder. add_module_tag ( ModuleTag :: new ( 5678 , 6789 , "module2" ) ) ;
335+ builder = builder. add_module_tag ( & ModuleTag :: new ( 5678 , 6789 , "module2" ) ) ;
337336 expected_len += 16 + 8 ;
338337 assert_eq ! ( builder. expected_len( ) , expected_len) ;
339338
0 commit comments