Skip to content

Commit 4e9b53d

Browse files
committed
cargo fmt
1 parent 2d61f27 commit 4e9b53d

File tree

33 files changed

+73
-81
lines changed

33 files changed

+73
-81
lines changed

bios/stage-2/src/memory_map.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// From http://wiki.osdev.org/Detecting_Memory_(x86)#Getting_an_E820_Memory_Map
22

33
use crate::split_array_ref;
4-
use bootloader_x86_64_bios_common::{racy_cell::RacyCell, E820MemoryRegion};
4+
use bootloader_x86_64_bios_common::{E820MemoryRegion, racy_cell::RacyCell};
55
use core::arch::asm;
66

77
static MEMORY_MAP: RacyCell<[E820MemoryRegion; 100]> = RacyCell::new(

bios/stage-2/src/vesa.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
use bootloader_x86_64_bios_common::PixelFormat;
44

5-
use crate::{disk::AlignedBuffer, AlignedArrayBuffer};
5+
use crate::{AlignedArrayBuffer, disk::AlignedBuffer};
66
use core::arch::asm;
77

88
#[repr(C, packed)]
@@ -109,11 +109,7 @@ impl<'a> VesaInfo<'a> {
109109
let base_ptr = video_mode_ptr as *const u16;
110110
let ptr = unsafe { base_ptr.add(index) };
111111
let mode = unsafe { *ptr };
112-
if mode == 0xffff {
113-
None
114-
} else {
115-
Some(mode)
116-
}
112+
if mode == 0xffff { None } else { Some(mode) }
117113
}
118114
}
119115

bios/stage-3/src/screen.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
use bootloader_x86_64_bios_common::{racy_cell::RacyCell, BiosFramebufferInfo, PixelFormat};
1+
use bootloader_x86_64_bios_common::{BiosFramebufferInfo, PixelFormat, racy_cell::RacyCell};
22
use core::{fmt, ptr};
3-
use noto_sans_mono_bitmap::{get_bitmap, BitmapChar, BitmapHeight, FontWeight};
3+
use noto_sans_mono_bitmap::{BitmapChar, BitmapHeight, FontWeight, get_bitmap};
44

55
static WRITER: RacyCell<Option<ScreenWriter>> = RacyCell::new(None);
66
pub struct Writer;

common/src/framebuffer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use bootloader_api::info::{FrameBufferInfo, PixelFormat};
22
use core::{fmt, ptr};
33
use font_constants::BACKUP_CHAR;
44
use noto_sans_mono_bitmap::{
5-
get_raster, get_raster_width, FontWeight, RasterHeight, RasterizedChar,
5+
FontWeight, RasterHeight, RasterizedChar, get_raster, get_raster_width,
66
};
77

88
/// Additional vertical space between lines

common/src/gdt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
use x86_64::{
2+
VirtAddr,
23
instructions::segmentation::{self, Segment},
34
structures::{
45
gdt::{Descriptor, GlobalDescriptorTable},
56
paging::PhysFrame,
67
},
7-
VirtAddr,
88
};
99

1010
pub fn create_and_load(frame: PhysFrame) {

common/src/legacy_memory_region.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
use bootloader_api::info::{MemoryRegion, MemoryRegionKind};
22
use core::{cmp, mem::MaybeUninit};
33
use x86_64::{
4-
align_down, align_up,
4+
PhysAddr, align_down, align_up,
55
structures::paging::{FrameAllocator, PhysFrame, Size4KiB},
6-
PhysAddr,
76
};
87

98
/// A slice of memory that is used by the bootloader and needs to be reserved

common/src/level_4_entries.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
use crate::{
2-
entropy,
3-
load_kernel::{calc_elf_memory_requirements, ElfMemoryRequirements, VirtualAddressOffset},
4-
BootInfo, RawFrameBufferInfo,
2+
BootInfo, RawFrameBufferInfo, entropy,
3+
load_kernel::{ElfMemoryRequirements, VirtualAddressOffset, calc_elf_memory_requirements},
54
};
6-
use bootloader_api::{config, info::MemoryRegion, BootloaderConfig};
5+
use bootloader_api::{BootloaderConfig, config, info::MemoryRegion};
76
use core::{alloc::Layout, iter::Step};
87
use rand::{
98
distributions::{Distribution, Uniform},
@@ -12,10 +11,10 @@ use rand::{
1211
use rand_hc::Hc128Rng;
1312
use usize_conversions::IntoUsize;
1413
use x86_64::{
15-
structures::paging::{Page, PageTableIndex, Size4KiB},
1614
PhysAddr, VirtAddr,
15+
structures::paging::{Page, PageTableIndex, Size4KiB},
1716
};
18-
use xmas_elf::{header, program::ProgramHeader, ElfFile};
17+
use xmas_elf::{ElfFile, header, program::ProgramHeader};
1918

2019
/// Keeps track of used entries in a level 4 page table.
2120
///

common/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@
44

55
use crate::legacy_memory_region::{LegacyFrameAllocator, LegacyMemoryRegion};
66
use bootloader_api::{
7+
BootInfo, BootloaderConfig,
78
config::Mapping,
89
info::{FrameBuffer, FrameBufferInfo, MemoryRegion, TlsTemplate},
9-
BootInfo, BootloaderConfig,
1010
};
1111
use bootloader_boot_config::{BootConfig, LevelFilter};
1212
use core::{alloc::Layout, arch::asm, mem::MaybeUninit, slice};
1313
use level_4_entries::UsedLevel4Entries;
1414
use usize_conversions::FromUsize;
1515
use x86_64::{
16+
PhysAddr, VirtAddr,
1617
structures::paging::{
17-
page_table::PageTableLevel, FrameAllocator, Mapper, OffsetPageTable, Page, PageSize,
18-
PageTableFlags, PageTableIndex, PhysFrame, Size2MiB, Size4KiB,
18+
FrameAllocator, Mapper, OffsetPageTable, Page, PageSize, PageTableFlags, PageTableIndex,
19+
PhysFrame, Size2MiB, Size4KiB, page_table::PageTableLevel,
1920
},
20-
PhysAddr, VirtAddr,
2121
};
2222
use xmas_elf::ElfFile;
2323

common/src/load_kernel.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
1-
use crate::{level_4_entries::UsedLevel4Entries, PAGE_SIZE};
1+
use crate::{PAGE_SIZE, level_4_entries::UsedLevel4Entries};
22
use bootloader_api::{config::Mapping, info::TlsTemplate};
33
use core::{cmp, iter::Step, mem::size_of, ops::Add};
44

55
use x86_64::{
6-
align_up,
6+
PhysAddr, VirtAddr, align_up,
77
structures::paging::{
8-
mapper::{MappedFrame, MapperAllSizes, TranslateResult},
98
FrameAllocator, Page, PageSize, PageTableFlags as Flags, PhysFrame, Size4KiB, Translate,
9+
mapper::{MappedFrame, MapperAllSizes, TranslateResult},
1010
},
11-
PhysAddr, VirtAddr,
1211
};
1312
use xmas_elf::{
14-
dynamic, header,
13+
ElfFile, dynamic, header,
1514
program::{self, ProgramHeader, SegmentData, Type},
1615
sections::Rela,
17-
ElfFile,
1816
};
1917

2018
use super::Kernel;
@@ -65,7 +63,7 @@ where
6563
return Err(concat!(
6664
"Invalid kernel_code mapping. ",
6765
"Executable can only be mapped at virtual_address_offset 0."
68-
))
66+
));
6967
}
7068
},
7169
header::Type::SharedObject => {

tests/test_kernels/config_file/src/bin/custom_config.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#![no_std] // don't link the Rust standard library
22
#![no_main] // disable all Rust-level entry points
33

4-
use bootloader_api::{entry_point, BootInfo};
4+
use bootloader_api::{BootInfo, entry_point};
55
use core::fmt::Write;
6-
use test_kernel_config_file::{exit_qemu, serial, QemuExitCode};
6+
use test_kernel_config_file::{QemuExitCode, exit_qemu, serial};
77

88
entry_point!(kernel_main);
99

0 commit comments

Comments
 (0)