Skip to content

Commit

Permalink
style: use Rust 2024 style edition
Browse files Browse the repository at this point in the history
  • Loading branch information
mkroening committed Feb 23, 2025
1 parent 7eb155d commit 19e5470
Show file tree
Hide file tree
Showing 12 changed files with 20 additions and 23 deletions.
1 change: 1 addition & 0 deletions rustfmt.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
group_imports = "StdExternalCrate"
hard_tabs = true
imports_granularity = "Module"
style_edition = "2024"
2 changes: 1 addition & 1 deletion src/arch/aarch64/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use core::arch::{asm, global_asm};

use aarch64_cpu::registers::{Writeable, SCTLR_EL1};
use aarch64_cpu::registers::{SCTLR_EL1, Writeable};
use log::info;

const BOOT_CORE_ID: u64 = 0; // ID of CPU for booting on SMP systems - this might be board specific in the future
Expand Down
6 changes: 3 additions & 3 deletions src/arch/aarch64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ use core::arch::asm;
use core::ptr::{self, NonNull};

use align_address::Align;
use goblin::elf::header::header64::{Header, EI_DATA, ELFDATA2LSB, ELFMAG, SELFMAG};
use goblin::elf::header::header64::{EI_DATA, ELFDATA2LSB, ELFMAG, Header, SELFMAG};
use hermit_dtb::Dtb;
use hermit_entry::Entry;
use hermit_entry::boot_info::{BootInfo, HardwareInfo, PlatformInfo, RawBootInfo, SerialPortBase};
use hermit_entry::elf::LoadedKernel;
use hermit_entry::Entry;
use log::info;
use sptr::Strict;

use crate::BootInfoExt;
use crate::arch::paging::*;
use crate::os::CONSOLE;
use crate::BootInfoExt;

unsafe extern "C" {
static mut loader_end: u8;
Expand Down
2 changes: 1 addition & 1 deletion src/arch/riscv64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ use core::{mem, slice};

use address_range::AddressRange;
use fdt::node::FdtNode;
use hermit_entry::Entry;
use hermit_entry::boot_info::{
BootInfo, DeviceTreeAddress, HardwareInfo, PlatformInfo, RawBootInfo,
};
use hermit_entry::elf::LoadedKernel;
use hermit_entry::Entry;
use log::info;
use sptr::Strict;

Expand Down
18 changes: 7 additions & 11 deletions src/arch/x86_64/firecracker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ use sptr::Strict;
use x86_64::structures::paging::{PageSize, PageTableFlags, Size2MiB, Size4KiB};

use super::physicalmem::PhysAlloc;
use super::{paging, KERNEL_STACK_SIZE, SERIAL_IO_PORT};
use crate::fdt::Fdt;
use super::{KERNEL_STACK_SIZE, SERIAL_IO_PORT, paging};
use crate::BootInfoExt;
use crate::fdt::Fdt;

unsafe extern "C" {
static mut loader_end: u8;
Expand Down Expand Up @@ -57,10 +57,10 @@ pub fn find_kernel() -> &'static [u8] {
{
info!("Found Linux kernel boot flag and header magic! Probably booting in firecracker.");
} else {
info!("Kernel boot flag and hdr magic have values 0x{:x} and 0x{:x} which does not align with the normal linux kernel values",
linux_kernel_boot_flag_magic,
linux_kernel_header_magic
);
info!(
"Kernel boot flag and hdr magic have values 0x{:x} and 0x{:x} which does not align with the normal linux kernel values",
linux_kernel_boot_flag_magic, linux_kernel_header_magic
);
}

// Load the boot_param memory-map information
Expand Down Expand Up @@ -155,11 +155,7 @@ pub unsafe fn boot_kernel(kernel_info: LoadedKernel) -> ! {
.strip_suffix('\0')
.unwrap();

if s.is_empty() {
None
} else {
Some(s)
}
if s.is_empty() { None } else { Some(s) }
} else {
None
};
Expand Down
2 changes: 1 addition & 1 deletion src/arch/x86_64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ pub unsafe fn enter_kernel(
) -> ! {
use core::arch::asm;

use hermit_entry::boot_info::RawBootInfo;
use hermit_entry::Entry;
use hermit_entry::boot_info::RawBootInfo;
use log::info;

// Check expected signature of entry function
Expand Down
2 changes: 1 addition & 1 deletion src/arch/x86_64/multiboot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ use x86_64::structures::paging::{PageSize, PageTableFlags, Size2MiB, Size4KiB};

use super::paging;
use super::physicalmem::PhysAlloc;
use crate::BootInfoExt;
use crate::arch::x86_64::{KERNEL_STACK_SIZE, SERIAL_IO_PORT};
use crate::fdt::Fdt;
use crate::BootInfoExt;

unsafe extern "C" {
static mut loader_end: u8;
Expand Down
2 changes: 1 addition & 1 deletion src/os/uefi/console.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use core::fmt;
use core::ptr::NonNull;

use one_shot_mutex::OneShotMutex;
use uefi::boot::{EventType, Tpl};
use uefi::Event;
use uefi::boot::{EventType, Tpl};

use crate::arch;

Expand Down
2 changes: 1 addition & 1 deletion src/os/uefi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use uefi::table::cfg;

pub use self::console::CONSOLE;
use crate::fdt::Fdt;
use crate::{arch, BootInfoExt};
use crate::{BootInfoExt, arch};

// Entry Point of the Uefi Loader
#[entry]
Expand Down
2 changes: 1 addition & 1 deletion xtask/src/ci/qemu.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::env;
use std::process::{Command, ExitStatus};

use anyhow::{ensure, Result};
use anyhow::{Result, ensure};
use clap::Args;
use sysinfo::{CpuRefreshKind, System};
use xshell::cmd;
Expand Down
2 changes: 1 addition & 1 deletion xtask/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ mod target;
use std::env;
use std::path::{Path, PathBuf};

use anyhow::{anyhow, Result};
use anyhow::{Result, anyhow};
use clap::Parser;

#[derive(Parser)]
Expand Down
2 changes: 1 addition & 1 deletion xtask/src/target.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::str::FromStr;

use anyhow::anyhow;
use xshell::{cmd, Shell};
use xshell::{Shell, cmd};

#[derive(Clone, Copy, PartialEq, Eq, Debug)]
pub enum Target {
Expand Down

0 comments on commit 19e5470

Please sign in to comment.