Skip to content

Commit b937096

Browse files
committed
Fix warnings
1 parent 4f5b574 commit b937096

File tree

7 files changed

+5
-22
lines changed

7 files changed

+5
-22
lines changed

bios/boot_sector/src/fail.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ fn hlt() {
5454
}
5555

5656
#[panic_handler]
57+
#[cfg(not(test))]
5758
pub fn panic(_info: &core::panic::PanicInfo) -> ! {
5859
fail(b'P');
5960
}

bios/boot_sector/src/mbr.rs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,5 @@
11
use super::fail::{fail, UnwrapOrFail};
22

3-
/// We use this partition type to store the second bootloader stage;
4-
const BOOTLOADER_SECOND_STAGE_PARTITION_TYPE: u8 = 0x20;
5-
6-
/// Returns the first bootable partition in the partition table.
7-
pub(crate) fn boot_partition(partitions_raw: &[u8]) -> Option<PartitionTableEntry> {
8-
for index in 0..4 {
9-
let entry = get_partition(partitions_raw, index);
10-
if entry.partition_type == BOOTLOADER_SECOND_STAGE_PARTITION_TYPE {
11-
return Some(entry);
12-
}
13-
}
14-
None
15-
}
16-
173
pub(crate) fn get_partition(partitions_raw: &[u8], index: usize) -> PartitionTableEntry {
184
const PARTITIONS_AREA_SIZE: usize = 16 * 4;
195
const ENTRY_SIZE: usize = 16;

bios/stage-2/src/fat.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,6 @@ impl<D: Read + Seek> FileSystem<D> {
189189
},
190190
None => {
191191
panic!("next none");
192-
return None;
193192
}
194193
},
195194
};

bios/stage-2/src/screen.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ impl core::fmt::Write for Writer {
3636
}
3737

3838
#[panic_handler]
39+
#[cfg(not(test))]
3940
pub fn panic(info: &core::panic::PanicInfo) -> ! {
4041
let _ = writeln!(Writer, "\nPANIC: {}", info);
4142

bios/stage-2/src/vesa.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
use bootloader_x86_64_bios_common::PixelFormat;
44

55
use crate::{disk::AlignedBuffer, AlignedArrayBuffer};
6-
use core::{arch::asm, fmt::Write as _};
6+
use core::arch::asm;
77

88
#[repr(packed)]
9+
#[allow(dead_code)]
910
struct VbeInfoBlock {
1011
signature: [u8; 4], // should be "VESA"
1112
version: u16, // should be 0x0300 for VBE 3.0

bios/stage-3/src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ pub fn enter_long_mode_and_jump_to_stage_4(info: &mut BiosInfo) {
6767
}
6868

6969
#[panic_handler]
70+
#[cfg(not(test))]
7071
pub fn panic(info: &core::panic::PanicInfo) -> ! {
7172
let _ = writeln!(Writer, "PANIC: {info}");
7273
loop {}

bios/stage-3/src/screen.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ pub fn init(info: BiosFramebufferInfo) {
2525

2626
/// Additional vertical space between lines
2727
const LINE_SPACING: usize = 0;
28-
/// Additional vertical space between separate log messages
29-
const LOG_SPACING: usize = 2;
3028

3129
struct ScreenWriter {
3230
framebuffer: &'static mut [u8],
@@ -52,10 +50,6 @@ impl ScreenWriter {
5250
self.carriage_return()
5351
}
5452

55-
fn add_vspace(&mut self, space: usize) {
56-
self.y_pos += space;
57-
}
58-
5953
fn carriage_return(&mut self) {
6054
self.x_pos = 0;
6155
}

0 commit comments

Comments
 (0)