Skip to content

Commit 2c8a630

Browse files
committed
Run cargo clippy --fix
1 parent daa554d commit 2c8a630

File tree

12 files changed

+16
-17
lines changed

12 files changed

+16
-17
lines changed

api/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ fn main() {
4343
);
4444
}
4545

46-
fs::write(&dest_path, code).unwrap();
46+
fs::write(dest_path, code).unwrap();
4747
println!("cargo:rerun-if-changed=build.rs");
4848

4949
let version_major: u16 = env!("CARGO_PKG_VERSION_MAJOR").parse().unwrap();

api/src/config.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,15 +132,14 @@ impl BootloaderConfig {
132132
Option::Some(addr) => concat_1_8([1], addr.to_le_bytes()),
133133
},
134134
);
135-
let buf = concat_106_9(
135+
136+
concat_106_9(
136137
buf,
137138
match minimum_framebuffer_width {
138139
Option::None => [0; 9],
139140
Option::Some(addr) => concat_1_8([1], addr.to_le_bytes()),
140141
},
141-
);
142-
143-
buf
142+
)
144143
}
145144

146145
/// Tries to deserialize a config byte array that was created using [`Self::serialize`].

bios/boot_sector/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ pub extern "C" fn first_stage(disk_number: u16) {
5454

5555
start_lba += u64::from(sectors);
5656
number_of_sectors -= u32::from(sectors);
57-
target_addr = target_addr + u32::from(sectors) * 512;
57+
target_addr += u32::from(sectors) * 512;
5858

5959
if number_of_sectors == 0 {
6060
break;

bios/boot_sector/src/mbr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ pub(crate) fn get_partition(partitions_raw: &[u8], index: usize) -> PartitionTab
1111
let offset = index * ENTRY_SIZE;
1212
let buffer = partitions_raw.get(offset..).unwrap_or_fail(b'c');
1313

14-
let bootable_raw = *buffer.get(0).unwrap_or_fail(b'd');
14+
let bootable_raw = *buffer.first().unwrap_or_fail(b'd');
1515
let bootable = bootable_raw == 0x80;
1616

1717
let partition_type = *buffer.get(4).unwrap_or_fail(b'e');

bios/stage-2/src/disk.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ impl Read for DiskAccess {
4747

4848
start_lba += u64::from(sectors);
4949
number_of_sectors -= u64::from(sectors);
50-
target_addr = target_addr + u32::from(sectors) * 512;
50+
target_addr += u32::from(sectors) * 512;
5151

5252
if number_of_sectors == 0 {
5353
break;

bios/stage-2/src/fat.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ impl<'a> RawDirectoryEntry<'a> {
391391
} else {
392392
fn slice_to_string(slice: &[u8]) -> Result<&str, ()> {
393393
const SKIP_SPACE: u8 = 0x20;
394-
let mut iter = slice.into_iter().copied();
394+
let mut iter = slice.iter().copied();
395395
match iter.position(|c| c != SKIP_SPACE) {
396396
Some(start_idx) => {
397397
let end_idx =

bios/stage-2/src/memory_map.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ pub unsafe fn query_memory_map() -> Result<&'static mut [E820MemoryRegion], ()>
4747
if buf_written_len != 0 {
4848
let buf = &buf[..buf_written_len];
4949

50-
let (&base_raw, rest) = split_array_ref(&buf);
50+
let (&base_raw, rest) = split_array_ref(buf);
5151
let (&len_raw, rest) = split_array_ref(rest);
5252
let (&kind_raw, rest) = split_array_ref(rest);
5353
let acpi_extended_raw: [u8; 4] = rest.try_into().unwrap_or_default();

src/fat.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub fn create_fat_filesystem(
2424
.write(true)
2525
.create(true)
2626
.truncate(true)
27-
.open(&out_fat_path)
27+
.open(out_fat_path)
2828
.unwrap();
2929
let fat_size_padded_and_rounded = ((needed_size + 1024 * 64 - 1) / MB + 1) * MB;
3030
fat_file.set_len(fat_size_padded_and_rounded).unwrap();

src/gpt.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ pub fn create_gpt_disk(fat_image: &Path, out_gpt_path: &Path) -> anyhow::Result<
1212
.truncate(true)
1313
.read(true)
1414
.write(true)
15-
.open(&out_gpt_path)
15+
.open(out_gpt_path)
1616
.with_context(|| format!("failed to create GPT file at `{}`", out_gpt_path.display()))?;
1717

1818
// set file size
19-
let partition_size: u64 = fs::metadata(&fat_image)
19+
let partition_size: u64 = fs::metadata(fat_image)
2020
.context("failed to read metadata of fat image")?
2121
.len();
2222
let disk_size = partition_size + 1024 * 64; // for GPT headers
@@ -61,7 +61,7 @@ pub fn create_gpt_disk(fat_image: &Path, out_gpt_path: &Path) -> anyhow::Result<
6161
disk.seek(io::SeekFrom::Start(start_offset))
6262
.context("failed to seek to start offset")?;
6363
io::copy(
64-
&mut File::open(&fat_image).context("failed to open FAT image")?,
64+
&mut File::open(fat_image).context("failed to open FAT image")?,
6565
&mut disk,
6666
)
6767
.context("failed to copy FAT image to GPT disk")?;

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ impl UefiBoot {
127127
files.insert(KERNEL_FILE_NAME, self.kernel.as_path());
128128

129129
let out_file = NamedTempFile::new().context("failed to create temp file")?;
130-
fat::create_fat_filesystem(files, &out_file.path())
130+
fat::create_fat_filesystem(files, out_file.path())
131131
.context("failed to create UEFI FAT filesystem")?;
132132

133133
Ok(out_file)

src/mbr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ pub fn create_mbr_disk(
6868
.truncate(true)
6969
.read(true)
7070
.write(true)
71-
.open(&out_mbr_path)
71+
.open(out_mbr_path)
7272
.with_context(|| {
7373
format!(
7474
"failed to create MBR disk image at `{}`",

uefi/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ fn load_kernel_file(image: Handle, st: &SystemTable<Boot>) -> Option<&'static mu
143143

144144
fn load_kernel_file_from_disk(image: Handle, st: &SystemTable<Boot>) -> Option<&'static mut [u8]> {
145145
let file_system_raw = {
146-
let ref this = st.boot_services();
146+
let this = st.boot_services();
147147
let loaded_image = this
148148
.open_protocol::<LoadedImage>(
149149
OpenProtocolParams {

0 commit comments

Comments
 (0)