Skip to content

Commit 7694432

Browse files
authoredSep 2, 2024··
Merge pull request #231 from rust-osdev/clippy
crate: fix latest clippy nightly complains
2 parents a50955a + b706b20 commit 7694432

File tree

14 files changed

+66
-33
lines changed

14 files changed

+66
-33
lines changed
 

‎.github/workflows/integrationtest.yml

+4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ name: "Integration Test"
1111
# Run on every push (tag, branch) and pull_request
1212
on: [ pull_request, push, merge_group ]
1313

14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
16+
cancel-in-progress: true
17+
1418
env:
1519
CARGO_TERM_COLOR: always
1620

‎.github/workflows/qa.yml

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ name: QA
22

33
on: [pull_request, push, merge_group]
44

5+
concurrency:
6+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
7+
cancel-in-progress: true
8+
59
jobs:
610
spellcheck:
711
name: Spellcheck

‎multiboot2-common/src/boxed.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ use core::mem;
77
use core::ops::Deref;
88
use core::ptr;
99

10-
/// Creates a new tag implementing [`MaybeDynSized`] on the heap. This works for
11-
/// sized and unsized tags. However, it only makes sense to use this for tags
12-
/// that are DSTs (unsized). For regular sized structs, you can just create a
13-
/// typical constructor and box the result.
10+
/// Creates a new tag implementing [`MaybeDynSized`] on the heap.
11+
///
12+
/// This works for sized and unsized tags. However, it only makes sense to use
13+
/// this for tags that are DSTs (unsized). For regular sized structs, you can
14+
/// just create a typical constructor and box the result.
1415
///
1516
/// The provided `header`' total size (see [`Header`]) will be set dynamically
1617
/// by this function using [`Header::set_size`]. However, it must contain all

‎multiboot2-common/src/bytes_ref.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ use core::mem;
66
use core::ops::Deref;
77

88
/// Wraps a byte slice representing a Multiboot2 structure including an optional
9-
/// terminating padding, if necessary. It guarantees that the memory
10-
/// requirements promised in the crates description are respected.
9+
/// terminating padding, if necessary.
10+
///
11+
/// Instances of this type guarantee that the memory requirements promised in
12+
/// the crates description are respected.
1113
#[derive(Clone, Debug, PartialEq, Eq)]
1214
#[repr(transparent)]
1315
pub struct BytesRef<'a, H: Header> {

‎multiboot2-common/src/lib.rs

+15-10
Original file line numberDiff line numberDiff line change
@@ -226,10 +226,12 @@ use core::slice;
226226
/// The alignment of all Multiboot2 data structures.
227227
pub const ALIGNMENT: usize = 8;
228228

229-
/// A sized header type for [`DynSizedStructure`]. Note that `header` refers to
230-
/// the header pattern. Thus, depending on the use case, this is not just a
231-
/// tag header. Instead, it refers to all bytes that are fixed and not part of
232-
/// any optional terminating dynamic `[u8]` slice in a [`DynSizedStructure`].
229+
/// A sized header type for [`DynSizedStructure`].
230+
///
231+
/// Note that `header` refers to the header pattern. Thus, depending on the use
232+
/// case, this is not just a tag header. Instead, it refers to all bytes that
233+
/// are fixed and not part of any optional terminating dynamic `[u8]` slice in a
234+
/// [`DynSizedStructure`].
233235
///
234236
/// The alignment of implementors **must** be the compatible with the demands
235237
/// for the corresponding structure, which typically is [`ALIGNMENT`].
@@ -251,9 +253,11 @@ pub trait Header: Clone + Sized + PartialEq + Eq + Debug {
251253
}
252254

253255
/// An C ABI-compatible dynamically sized type with a common sized [`Header`]
254-
/// and a dynamic amount of bytes. This structures owns all its bytes, unlike
255-
/// [`Header`]. Instances guarantees that the memory requirements promised in
256-
/// the crates description are respected.
256+
/// and a dynamic amount of bytes.
257+
///
258+
/// This structures owns all its bytes, unlike [`Header`]. Instances guarantees
259+
/// that the memory requirements promised in the crates description are
260+
/// respected.
257261
///
258262
/// This can be a Multiboot2 header tag, information tag, boot information, or
259263
/// a Multiboot2 header. Depending on the context, the [`Header`] is different.
@@ -386,9 +390,10 @@ pub enum MemoryError {
386390
impl core::error::Error for MemoryError {}
387391

388392
/// Increases the given size to the next alignment boundary, if it is not a
389-
/// multiple of the alignment yet. This is relevant as in Rust's [type layout],
390-
/// the allocated size of a type is always a multiple of the alignment, even
391-
/// if the type is smaller.
393+
/// multiple of the alignment yet.
394+
///
395+
/// This is relevant as in Rust's [type layout], the allocated size of a type is
396+
/// always a multiple of the alignment, even if the type is smaller.
392397
///
393398
/// [type layout]: https://doc.rust-lang.org/reference/type-layout.html
394399
#[must_use]

‎multiboot2-common/src/test_utils.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ use core::mem;
88
use core::ops::Deref;
99

1010
/// Helper to 8-byte align the underlying bytes, as mandated in the Multiboot2
11-
/// spec. With this type, one can create manual and raw Multiboot2 boot
12-
/// information or just the bytes for simple tags, in a manual and raw approach.
11+
/// spec.
12+
///
13+
/// With this type, one can create manual and raw Multiboot2 boot information or
14+
/// just the bytes for simple tags, in a manual and raw approach.
1315
#[derive(Debug)]
1416
#[repr(C, align(8))]
1517
pub struct AlignedBytes<const N: usize>(pub [u8; N]);

‎multiboot2-header/src/address.rs

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ use crate::{HeaderTagFlag, HeaderTagHeader, HeaderTagType};
22
use core::mem::size_of;
33
use multiboot2_common::{MaybeDynSized, Tag};
44

5+
/// Binary address information for non-ELF images.
6+
///
57
/// This information does not need to be provided if the kernel image is in ELF
68
/// format, but it must be provided if the image is in a.out format or in some
79
/// other format. Required for legacy boot (BIOS).

‎multiboot2-header/src/entry_efi_32.rs

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ use core::fmt::{Debug, Formatter};
44
use core::mem;
55
use multiboot2_common::{MaybeDynSized, Tag};
66

7+
/// Contains the entry address for EFI i386 machine state.
8+
///
79
/// This tag is taken into account only on EFI i386 platforms when Multiboot2 image header
810
/// contains EFI boot services tag. Then entry point specified in ELF header and the entry address
911
/// tag of Multiboot2 header are ignored.

‎multiboot2-header/src/entry_efi_64.rs

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ use core::fmt::{Debug, Formatter};
44
use core::mem;
55
use multiboot2_common::{MaybeDynSized, Tag};
66

7+
/// Contains the entry address for EFI amd64 machine state.
8+
///
79
/// This tag is taken into account only on EFI amd64 platforms when Multiboot2 image header
810
/// contains EFI boot services tag. Then entry point specified in ELF header and the entry address
911
/// tag of Multiboot2 header are ignored.

‎multiboot2-header/src/header.rs

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ use multiboot2_common::{DynSizedStructure, Header, MemoryError, Tag, ALIGNMENT};
1515
pub const MAGIC: u32 = 0xe85250d6;
1616

1717
/// Wrapper type around a pointer to the Multiboot2 header.
18+
///
1819
/// The Multiboot2 header is the [`Multiboot2BasicHeader`] followed
1920
/// by all tags (see [`crate::tags::HeaderTagType`]).
2021
/// Use this if you get a pointer to the header and just want

‎multiboot2-header/src/relocatable.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ use core::fmt::{Debug, Formatter};
44
use core::mem;
55
use multiboot2_common::{MaybeDynSized, Tag};
66

7-
/// It contains load address placement suggestion for boot loader. Boot loader
8-
/// should follow it. ‘0’ means none, ‘1’ means load image at lowest possible address
9-
/// but not lower than min addr and ‘2’ means load image at highest possible
10-
/// address but not higher than max addr.
7+
/// It contains load address placement suggestion for bootloader.
8+
///
9+
/// Bootloader should follow it. ‘0’ means none, ‘1’ means load image at lowest
10+
/// possible address but not lower than min addr and ‘2’ means load image at
11+
/// highest possible address but not higher than max addr.
1112
#[repr(u32)]
1213
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
1314
pub enum RelocatableHeaderTagPreference {

‎multiboot2-header/src/tags.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@ pub enum HeaderTagISA {
1818
MIPS32 = 4,
1919
}
2020

21-
/// Possible types for header tags of a Multiboot2 header. The names and values are taken
22-
/// from the example C code at the bottom of the Multiboot2 specification. This value
23-
/// stands in the `typ` property of [`HeaderTagHeader`].
21+
/// Possible types for header tags of a Multiboot2 header.
22+
///
23+
/// The names and values are taken from the example C code at the bottom of the
24+
/// Multiboot2 specification. This value stands in the `typ` property of
25+
/// [`HeaderTagHeader`].
2426
#[repr(u16)]
2527
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
2628
pub enum HeaderTagType {

‎multiboot2/src/framebuffer.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -371,9 +371,11 @@ pub struct FramebufferField {
371371
pub size: u8,
372372
}
373373

374-
/// A framebuffer color descriptor in the palette. On the ABI level, multiple
375-
/// values are consecutively without padding bytes. The spec is not precise in
376-
/// that regard, but looking at Limine's and GRUB's source code confirm that.
374+
/// A framebuffer color descriptor in the palette.
375+
///
376+
/// On the ABI level, multiple values are consecutively without padding bytes.
377+
/// The spec is not precise in that regard, but looking at Limine's and GRUB's
378+
/// source code confirm that.
377379
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
378380
#[repr(C)] // no align(8) here is correct
379381
pub struct FramebufferColor {

‎multiboot2/src/tag_type.rs

+8-5
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ use core::fmt::{Debug, Formatter};
66
use core::hash::Hash;
77

88
/// Serialized form of [`TagType`] that matches the binary representation
9-
/// (`u32`). The abstraction corresponds to the `typ`/`type` field of a
10-
/// Multiboot2 [`TagHeader`]. This type can easily be created from or converted to
9+
/// (`u32`).
10+
///
11+
/// The abstraction corresponds to the `typ`/`type` field of a Multiboot2
12+
/// [`TagHeader`]. This type can easily be created from or converted to
1113
/// [`TagType`].
1214
///
1315
/// [`TagHeader`]: crate::TagHeader
@@ -31,9 +33,10 @@ impl Debug for TagTypeId {
3133
}
3234

3335
/// Higher level abstraction for [`TagTypeId`] that assigns each possible value
34-
/// to a specific semantic according to the specification. Additionally, it
35-
/// allows to use the [`TagType::Custom`] variant. It is **not binary compatible**
36-
/// with [`TagTypeId`].
36+
/// to a specific semantic according to the specification.
37+
///
38+
/// Additionally, it allows to use the [`TagType::Custom`] variant. It is
39+
/// **not binary compatible** with [`TagTypeId`].
3740
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
3841
pub enum TagType {
3942
/// Tag `0`: Marks the end of the tags.

0 commit comments

Comments
 (0)
Please sign in to comment.