فهرست منبع

clippy: apply new fixes

Philipp Schuster 1 سال پیش
والد
کامیت
d08e5eb7bc
4فایلهای تغییر یافته به همراه100 افزوده شده و 41 حذف شده
  1. 12 5
      multiboot2-header/Changelog.md
  2. 6 0
      multiboot2-header/src/end.rs
  3. 76 36
      multiboot2/Changelog.md
  4. 6 0
      multiboot2/src/builder/information.rs

+ 12 - 5
multiboot2-header/Changelog.md

@@ -1,5 +1,9 @@
 # CHANGELOG for crate `multiboot2-header`
 # CHANGELOG for crate `multiboot2-header`
 
 
+## Unreleased
+
+- added `EndHeaderTag::default()`
+
 ## 0.3.2 (2023-11-30)
 ## 0.3.2 (2023-11-30)
 
 
 - **BREAKING** bumped `multiboot2` dependency to `v0.19.0`
 - **BREAKING** bumped `multiboot2` dependency to `v0.19.0`
@@ -22,20 +26,23 @@
 - **BREAKING** `HeaderBuilder::build` now returns a value of type `HeaderBytes`
 - **BREAKING** `HeaderBuilder::build` now returns a value of type `HeaderBytes`
   The old builder could produce misaligned structures.
   The old builder could produce misaligned structures.
 - added the optional `unstable` feature (requires nightly)
 - added the optional `unstable` feature (requires nightly)
-  - implement `core::error::Error` for `LoadError`
+    - implement `core::error::Error` for `LoadError`
 
 
 ## 0.2.0 (2022-05-03)
 ## 0.2.0 (2022-05-03)
 
 
 - **BREAKING** renamed `EntryHeaderTag` to `EntryAddressHeaderTag`
 - **BREAKING** renamed `EntryHeaderTag` to `EntryAddressHeaderTag`
-- **BREAKING** some paths changed from `multiboot2_header::header` to `multiboot2_header::builder`
-   -> thus, import paths are much more logically now
+- **BREAKING** some paths changed from `multiboot2_header::header`
+  to `multiboot2_header::builder`
+  -> thus, import paths are much more logically now
 - internal code improvements
 - internal code improvements
 
 
 ## 0.1.1 (2022-05-02)
 ## 0.1.1 (2022-05-02)
 
 
 - fixed a bug that prevented the usage of the crate in `no_std` environments
 - fixed a bug that prevented the usage of the crate in `no_std` environments
-- added a new default `builder`-feature to Cargo which requires the `alloc`-crate
-  (this feature can be disabled which will also remove the dependency to the `alloc` crate)
+- added a new default `builder`-feature to Cargo which requires the `alloc`
+  -crate
+  (this feature can be disabled which will also remove the dependency to
+  the `alloc` crate)
 
 
 ## 0.1.0 (2021-10-08)
 ## 0.1.0 (2021-10-08)
 
 

+ 6 - 0
multiboot2-header/src/end.rs

@@ -12,6 +12,12 @@ pub struct EndHeaderTag {
     size: u32,
     size: u32,
 }
 }
 
 
+impl Default for EndHeaderTag {
+    fn default() -> Self {
+        Self::new()
+    }
+}
+
 impl EndHeaderTag {
 impl EndHeaderTag {
     pub const fn new() -> Self {
     pub const fn new() -> Self {
         EndHeaderTag {
         EndHeaderTag {

+ 76 - 36
multiboot2/Changelog.md

@@ -1,6 +1,11 @@
 # CHANGELOG for crate `multiboot2`
 # CHANGELOG for crate `multiboot2`
 
 
+## Unreleased
+
+- added `InformationBuilder::default()`
+
 ## 0.19.0 (2023-09-21)
 ## 0.19.0 (2023-09-21)
+
 - **BREAKING** MSRV is 1.69.0
 - **BREAKING** MSRV is 1.69.0
 - **BREAKING** `Tag::get_dst_str_slice` renamed to
 - **BREAKING** `Tag::get_dst_str_slice` renamed to
   `Tag::parse_slice_as_string` and now returns `Result<&str, StringError>`
   `Tag::parse_slice_as_string` and now returns `Result<&str, StringError>`
@@ -14,9 +19,11 @@
   `add_tag` was introduced for that.
   `add_tag` was introduced for that.
 
 
 ## 0.18.1 (2023-07-13)
 ## 0.18.1 (2023-07-13)
+
 - Documentation improvements
 - Documentation improvements
 
 
 ## 0.18.0 (2023-07-13)
 ## 0.18.0 (2023-07-13)
+
 - **BREAKING** The `TagTrait` was enhanced and now has an associated `ID`
 - **BREAKING** The `TagTrait` was enhanced and now has an associated `ID`
   constant. This is only breaking to users that used `BootInformation::get_tag`
   constant. This is only breaking to users that used `BootInformation::get_tag`
   or that implement custom tags. `BootInformation::get_tag` doesn't need the
   or that implement custom tags. `BootInformation::get_tag` doesn't need the
@@ -37,29 +44,39 @@
 - Internal code cleanup.
 - Internal code cleanup.
 
 
 ## 0.17.0 (2023-07-12)
 ## 0.17.0 (2023-07-12)
-- **BREAKING** Make functions of `InformationBuilder` chainable. They now consume the builder.
+
+- **BREAKING** Make functions of `InformationBuilder` chainable. They now
+  consume the builder.
 - **BREAKING** Allow non-standard memory area types by using new pair of
 - **BREAKING** Allow non-standard memory area types by using new pair of
   corresponding types: `MemoryAreaTypeId` and `MemoryAreaType`.
   corresponding types: `MemoryAreaTypeId` and `MemoryAreaType`.
 
 
 ## 0.16.0 (2023-06-23)
 ## 0.16.0 (2023-06-23)
+
 - **BREAKING** renamed `MULTIBOOT2_BOOTLOADER_MAGIC` to `MAGIC`
 - **BREAKING** renamed `MULTIBOOT2_BOOTLOADER_MAGIC` to `MAGIC`
 - **BREAKING** `EFIMemoryDesc` was removed and is now an alias of
 - **BREAKING** `EFIMemoryDesc` was removed and is now an alias of
   `uefi_raw::table::boot::MemoryDescriptor`
   `uefi_raw::table::boot::MemoryDescriptor`
 - **BREAKING**  `EFIMemoryAreaType` was removed and is now an alias of
 - **BREAKING**  `EFIMemoryAreaType` was removed and is now an alias of
   `uefi_raw::table::boot::MemoryType`
   `uefi_raw::table::boot::MemoryType`
 - **BREAKING** MSRV is 1.68.0
 - **BREAKING** MSRV is 1.68.0
-- **BREAKING** Removed `MemoryAreaIter` and `MemoryMapTag::available_memory_areas`
-- **BREAKING** Renamed `BootInformation::load_base_addr` to `BootInformation::load_base_addr_tag`
-- **BREAKING** Renamed `BootInformation::efi_32_ih` to `BootInformation::efi_32_ih_tag`
-- **BREAKING** Renamed `BootInformation::efi_32_ih` to `BootInformation::efi_32_ih_tag`
+- **BREAKING** Removed `MemoryAreaIter`
+  and `MemoryMapTag::available_memory_areas`
+- **BREAKING** Renamed `BootInformation::load_base_addr`
+  to `BootInformation::load_base_addr_tag`
+- **BREAKING** Renamed `BootInformation::efi_32_ih`
+  to `BootInformation::efi_32_ih_tag`
+- **BREAKING** Renamed `BootInformation::efi_32_ih`
+  to `BootInformation::efi_32_ih_tag`
 - **BREAKING** Renamed `ImageLoadPhysAddr` to `ImageLoadPhysAddrTag`
 - **BREAKING** Renamed `ImageLoadPhysAddr` to `ImageLoadPhysAddrTag`
 - **BREAKING** Renamed `EFIImageHandle32` to `EFIImageHandle32Tag`
 - **BREAKING** Renamed `EFIImageHandle32` to `EFIImageHandle32Tag`
 - **BREAKING** Renamed `EFIImageHandle64` to `EFIImageHandle64Tag`
 - **BREAKING** Renamed `EFIImageHandle64` to `EFIImageHandle64Tag`
 - **BREAKING** Renamed `EFISdt32` to `EFISdt32Tag`
 - **BREAKING** Renamed `EFISdt32` to `EFISdt32Tag`
 - **BREAKING** Renamed `EFISdt64` to `EFISdt64Tag`
 - **BREAKING** Renamed `EFISdt64` to `EFISdt64Tag`
-- **BREAKING** Renamed `EFIBootServicesNotExited` to `EFIBootServicesNotExitedTag`
-- **BREAKING** Renamed `CommandLineTag::command_line` renamed to `CommandLineTag::cmdline`
-- **\[Might be\] BREAKING** Added `TagTrait` trait which enables to use DSTs as multiboot2 tags. This is
+- **BREAKING** Renamed `EFIBootServicesNotExited`
+  to `EFIBootServicesNotExitedTag`
+- **BREAKING** Renamed `CommandLineTag::command_line` renamed
+  to `CommandLineTag::cmdline`
+- **\[Might be\] BREAKING** Added `TagTrait` trait which enables to use DSTs as
+  multiboot2 tags. This is
   mostly relevant for the command line tag, the modules tag, and the bootloader
   mostly relevant for the command line tag, the modules tag, and the bootloader
   name tag. However, this might also be relevant for users of custom multiboot2
   name tag. However, this might also be relevant for users of custom multiboot2
   tags that use DSTs as types. See the example provided in the doc of the
   tags that use DSTs as types. See the example provided in the doc of the
@@ -72,6 +89,7 @@
 - added `MemoryMapTag::entry_size` and `MemoryMapTag::entry_version`
 - added `MemoryMapTag::entry_size` and `MemoryMapTag::entry_version`
 
 
 ## 0.15.1 (2023-03-18)
 ## 0.15.1 (2023-03-18)
+
 - **BREAKING** `MemoryMapTag::all_memory_areas()` was renamed to `memory_areas`
 - **BREAKING** `MemoryMapTag::all_memory_areas()` was renamed to `memory_areas`
   and now returns `MemoryAreaIter` instead of
   and now returns `MemoryAreaIter` instead of
   `impl Iterator<Item = &MemoryArea>`. Experience showed that its better to
   `impl Iterator<Item = &MemoryArea>`. Experience showed that its better to
@@ -86,14 +104,16 @@
 - fix: prevent a possible panic in `ElfSection::section_type()`
 - fix: prevent a possible panic in `ElfSection::section_type()`
 
 
 ## 0.15.0 (2023-03-17)
 ## 0.15.0 (2023-03-17)
+
 - **BREAKING** MSRV is 1.56.1
 - **BREAKING** MSRV is 1.56.1
 - **BREAKING** fixed lifetime issues: `VBEInfoTag` is no longer `&static`
 - **BREAKING** fixed lifetime issues: `VBEInfoTag` is no longer `&static`
 - **BREAKING:** `TagType` is now split into `TagTypeId` and `TagType`
 - **BREAKING:** `TagType` is now split into `TagTypeId` and `TagType`
-  - `TagTypeId` is a binary-compatible form of a Multiboot2 tag id
-  - `TagType` is a higher-level abstraction for either specified or custom tags
-     but not ABI compatible.
-  - There exists a seamless integration between `u32`, `TagType`, and
-    `TagTypeId` via `From` and `PartialEq`-implementations.
+    - `TagTypeId` is a binary-compatible form of a Multiboot2 tag id
+    - `TagType` is a higher-level abstraction for either specified or custom
+      tags
+      but not ABI compatible.
+    - There exists a seamless integration between `u32`, `TagType`, and
+      `TagTypeId` via `From` and `PartialEq`-implementations.
 - fixed another internal lifetime issue
 - fixed another internal lifetime issue
 - `BootInformation::framebuffer_tag()` now returns
 - `BootInformation::framebuffer_tag()` now returns
   `Option<Result<FramebufferTag, UnknownFramebufferType>>` instead of
   `Option<Result<FramebufferTag, UnknownFramebufferType>>` instead of
@@ -106,6 +126,7 @@
   from.
   from.
 
 
 ## 0.14.2 (2023-03-17)
 ## 0.14.2 (2023-03-17)
+
 - documentation fixes
 - documentation fixes
 - `MbiLoadError` now implements `Display`
 - `MbiLoadError` now implements `Display`
 - Added the `unstable` feature, which enables nightly-only functionality.
 - Added the `unstable` feature, which enables nightly-only functionality.
@@ -113,53 +134,67 @@
   be used with `anyhow::Result` for example.
   be used with `anyhow::Result` for example.
 
 
 ## 0.14.1 (2023-03-09)
 ## 0.14.1 (2023-03-09)
-- fixed the calculation of the last area of the memory map tag ([#119](https://github.com/rust-osdev/multiboot2/pull/119))
-  (Previously, iterating the EFI Memory map resulted in a superfluous entry as it ran over the next tag)
+
+- fixed the calculation of the last area of the memory map
+  tag ([#119](https://github.com/rust-osdev/multiboot2/pull/119))
+  (Previously, iterating the EFI Memory map resulted in a superfluous entry as
+  it ran over the next tag)
 
 
 ## 0.14.0 (2022-06-30)
 ## 0.14.0 (2022-06-30)
+
 - **BREAKING CHANGES** \
 - **BREAKING CHANGES** \
-  This version includes a few small breaking changes that brings more safety when parsing strings from the
+  This version includes a few small breaking changes that brings more safety
+  when parsing strings from the
   multiboot information structure.
   multiboot information structure.
-  - `BootLoaderNameTag::name` now returns a Result instead of just the value
-  - `CommandLineTag::command_line` now returns a Result instead of just the value
-  - `ModuleTag::cmdline` now returns a Result instead of just the value
-  - `RsdpV1Tag::signature` now returns a Result instead of an Option
-  - `RsdpV1Tag::oem_id` now returns a Result instead of an Option
-  - `RsdpV2Tag::signature` now returns a Result instead of an Option
-  - `RsdpV2Tag::oem_id` now returns a Result instead of an Option
+    - `BootLoaderNameTag::name` now returns a Result instead of just the value
+    - `CommandLineTag::command_line` now returns a Result instead of just the
+      value
+    - `ModuleTag::cmdline` now returns a Result instead of just the value
+    - `RsdpV1Tag::signature` now returns a Result instead of an Option
+    - `RsdpV1Tag::oem_id` now returns a Result instead of an Option
+    - `RsdpV2Tag::signature` now returns a Result instead of an Option
+    - `RsdpV2Tag::oem_id` now returns a Result instead of an Option
 - internal code improvements
 - internal code improvements
 
 
 ## 0.13.3 (2022-06-03)
 ## 0.13.3 (2022-06-03)
+
 - impl `Send` for `BootInformation`
 - impl `Send` for `BootInformation`
 
 
 ## 0.13.2 (2022-05-02)
 ## 0.13.2 (2022-05-02)
+
 - `TagType` now implements `Ord` so that it can be used in `BTreeSet`
 - `TagType` now implements `Ord` so that it can be used in `BTreeSet`
-- small internal improvements and restructuring of the code (no breaking changes to public API)
+- small internal improvements and restructuring of the code (no breaking changes
+  to public API)
 
 
 ## 0.13.1 (2022-01-09)
 ## 0.13.1 (2022-01-09)
+
 - minor fix
 - minor fix
 
 
 ## 0.13.0 (**yanked**)
 ## 0.13.0 (**yanked**)
+
 - added missing getters for tag `ImageLoadPhysAddr`
 - added missing getters for tag `ImageLoadPhysAddr`
 - added missing getters for tags `EFIImageHandle32` and `EFIImageHandle64`
 - added missing getters for tags `EFIImageHandle32` and `EFIImageHandle64`
 
 
 ## 0.12.2 (2021-10-02)
 ## 0.12.2 (2021-10-02)
+
 - `TagType` now implements `Eq` and `Hash`
 - `TagType` now implements `Eq` and `Hash`
 - internal improvements
 - internal improvements
-  - `std` can be used in tests; the crate is still `no_std`
-    - this implies that `cargo test` doesn't work on "non-standard" targets
-    - CI (Ubuntu) still works.
-  - code formatting/style
-  - sensible style checks as optional CI job
-  - `.editorconfig` file
-  - prepared co-existence of crates `multiboot2` and `multiboot2-header`
-    in a Cargo workspace inside the same repository
+    - `std` can be used in tests; the crate is still `no_std`
+        - this implies that `cargo test` doesn't work on "non-standard" targets
+        - CI (Ubuntu) still works.
+    - code formatting/style
+    - sensible style checks as optional CI job
+    - `.editorconfig` file
+    - prepared co-existence of crates `multiboot2` and `multiboot2-header`
+      in a Cargo workspace inside the same repository
 
 
 ## 0.12.1 (2021-08-11)
 ## 0.12.1 (2021-08-11)
+
 - `TagType`-enum introduced in `v0.11` is now actually public
 - `TagType`-enum introduced in `v0.11` is now actually public
 - internal code improvements
 - internal code improvements
 
 
 ## 0.12.0 (2021-08-06)
 ## 0.12.0 (2021-08-06)
+
 - **breaking:** `load()` and `load_with_offset` now returns a result
 - **breaking:** `load()` and `load_with_offset` now returns a result
 - added public constant `MULTIBOOT2_BOOTLOADER_MAGIC`
 - added public constant `MULTIBOOT2_BOOTLOADER_MAGIC`
 - Rust edition 2018 (instead of 2015)
 - Rust edition 2018 (instead of 2015)
@@ -167,21 +202,26 @@
 
 
 ## 0.11.0 (2021-07-07)
 ## 0.11.0 (2021-07-07)
 
 
-- **breaking:** iterator functions (e.g. `ElfSectionsTag::sections()`) return `impl Iterator` instead of a concrete type
+- **breaking:** iterator functions (e.g. `ElfSectionsTag::sections()`)
+  return `impl Iterator` instead of a concrete type
 - lib now contains `TagType`-enum that contains
 - lib now contains `TagType`-enum that contains
   all possible mbi tags that are specified (taken from spec)
   all possible mbi tags that are specified (taken from spec)
 - much improved debug-formatting of `BootInformation`
 - much improved debug-formatting of `BootInformation`
 - internal code improvements / formatting
 - internal code improvements / formatting
 
 
 ## 0.10.0 (2020-11-03)
 ## 0.10.0 (2020-11-03)
+
 - allow access to all memory regions (MemoryMap-Tag)
 - allow access to all memory regions (MemoryMap-Tag)
 - internal code improvements
 - internal code improvements
 
 
 ## 0.9.0 (2020-07-06)
 ## 0.9.0 (2020-07-06)
 
 
-- Add a `checksum_is_valid` method to the RSDP tags ([#64](https://github.com/rust-osdev/multiboot2/pull/64))
+- Add a `checksum_is_valid` method to the RSDP
+  tags ([#64](https://github.com/rust-osdev/multiboot2/pull/64))
 
 
 ## 0.8.2 (2022-03-02)
 ## 0.8.2 (2022-03-02)
 
 
-- Add some basic documentation ([#62](https://github.com/rust-osdev/multiboot2/pull/62))
-- Add MemoryAreaType, to allow users to access memory area types in a type-safe way ([#61](https://github.com/rust-osdev/multiboot2/pull/61))
+- Add some basic
+  documentation ([#62](https://github.com/rust-osdev/multiboot2/pull/62))
+- Add MemoryAreaType, to allow users to access memory area types in a type-safe
+  way ([#61](https://github.com/rust-osdev/multiboot2/pull/61))

+ 6 - 0
multiboot2/src/builder/information.rs

@@ -64,6 +64,12 @@ impl core::error::Error for RedundantTagError {}
 #[derive(Debug, PartialEq, Eq)]
 #[derive(Debug, PartialEq, Eq)]
 pub struct InformationBuilder(Vec<(TagType, SerializedTag)>);
 pub struct InformationBuilder(Vec<(TagType, SerializedTag)>);
 
 
+impl Default for InformationBuilder {
+    fn default() -> Self {
+        Self::new()
+    }
+}
+
 impl InformationBuilder {
 impl InformationBuilder {
     /// Creates a new builder.
     /// Creates a new builder.
     pub const fn new() -> Self {
     pub const fn new() -> Self {