mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-16 14:27:49 +00:00
Run cargo fmt
This commit is contained in:
@@ -4,8 +4,8 @@
|
|||||||
#![test_runner(blog_os::test_runner)]
|
#![test_runner(blog_os::test_runner)]
|
||||||
#![reexport_test_harness_main = "test_main"]
|
#![reexport_test_harness_main = "test_main"]
|
||||||
|
|
||||||
use core::panic::PanicInfo;
|
|
||||||
use blog_os::{println, serial_print, serial_println};
|
use blog_os::{println, serial_print, serial_println};
|
||||||
|
use core::panic::PanicInfo;
|
||||||
|
|
||||||
#[no_mangle] // don't mangle the name of this function
|
#[no_mangle] // don't mangle the name of this function
|
||||||
pub extern "C" fn _start() -> ! {
|
pub extern "C" fn _start() -> ! {
|
||||||
|
|||||||
@@ -2,8 +2,11 @@
|
|||||||
#![no_main]
|
#![no_main]
|
||||||
#![feature(panic_info_message)]
|
#![feature(panic_info_message)]
|
||||||
|
|
||||||
use core::{fmt::{self, Write}, panic::PanicInfo};
|
use blog_os::{exit_qemu, serial_print, serial_println, QemuExitCode};
|
||||||
use blog_os::{serial_print, serial_println, QemuExitCode, exit_qemu};
|
use core::{
|
||||||
|
fmt::{self, Write},
|
||||||
|
panic::PanicInfo,
|
||||||
|
};
|
||||||
|
|
||||||
const MESSAGE: &str = "Example panic message from panic_handler test";
|
const MESSAGE: &str = "Example panic message from panic_handler test";
|
||||||
const PANIC_LINE: u32 = 14; // adjust this when moving the `panic!` call
|
const PANIC_LINE: u32 = 14; // adjust this when moving the `panic!` call
|
||||||
@@ -11,11 +14,11 @@ const PANIC_LINE: u32 = 14; // adjust this when moving the `panic!` call
|
|||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn _start() -> ! {
|
pub extern "C" fn _start() -> ! {
|
||||||
serial_print!("panic_handler... ");
|
serial_print!("panic_handler... ");
|
||||||
panic!(MESSAGE); // must be in line `PANIC_LINE`
|
panic!(MESSAGE); // must be in line `PANIC_LINE`
|
||||||
}
|
}
|
||||||
|
|
||||||
#[panic_handler]
|
#[panic_handler]
|
||||||
fn panic(info: &PanicInfo) -> ! {
|
fn panic(info: &PanicInfo) -> ! {
|
||||||
check_location(info);
|
check_location(info);
|
||||||
check_message(info);
|
check_message(info);
|
||||||
|
|
||||||
@@ -51,7 +54,7 @@ fn check_message(info: &PanicInfo) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Compares a `fmt::Arguments` instance with the `MESSAGE` string
|
/// Compares a `fmt::Arguments` instance with the `MESSAGE` string
|
||||||
///
|
///
|
||||||
/// To use this type, write the `fmt::Arguments` instance to it using the
|
/// To use this type, write the `fmt::Arguments` instance to it using the
|
||||||
/// `write` macro. If a message component matches `MESSAGE`, the equals
|
/// `write` macro. If a message component matches `MESSAGE`, the equals
|
||||||
/// field is set to true.
|
/// field is set to true.
|
||||||
@@ -66,4 +69,4 @@ impl fmt::Write for CompareMessage {
|
|||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user