From 6529cbc6742daf5c03716c9572463fdc2d5286f7 Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Tue, 12 Jun 2018 19:26:17 +0200 Subject: [PATCH] Run rustfmt --- src/bin/test-basic-boot.rs | 13 ++++++++----- src/bin/test-panic.rs | 6 ++++-- src/lib.rs | 2 +- src/main.rs | 2 +- src/serial.rs | 9 ++++++--- 5 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/bin/test-basic-boot.rs b/src/bin/test-basic-boot.rs index 93655ff6..0dee6041 100644 --- a/src/bin/test-basic-boot.rs +++ b/src/bin/test-basic-boot.rs @@ -7,9 +7,9 @@ #[macro_use] extern crate blog_os; +use blog_os::exit_qemu; #[cfg(not(test))] use core::panic::PanicInfo; -use blog_os::exit_qemu; /// This function is the entry point, since the linker looks for a function /// named `_start_` by default. @@ -18,11 +18,12 @@ use blog_os::exit_qemu; pub extern "C" fn _start() -> ! { serial_println!("ok"); - unsafe { exit_qemu(); } + unsafe { + exit_qemu(); + } loop {} } - /// This function is called on panic. #[cfg(not(test))] #[panic_implementation] @@ -32,6 +33,8 @@ pub fn panic(info: &PanicInfo) -> ! { serial_println!("{}", info); - unsafe { exit_qemu(); } + unsafe { + exit_qemu(); + } loop {} -} \ No newline at end of file +} diff --git a/src/bin/test-panic.rs b/src/bin/test-panic.rs index a3ac10e3..044d5666 100644 --- a/src/bin/test-panic.rs +++ b/src/bin/test-panic.rs @@ -6,9 +6,9 @@ #[macro_use] extern crate blog_os; +use blog_os::exit_qemu; #[cfg(not(test))] use core::panic::PanicInfo; -use blog_os::exit_qemu; #[cfg(not(test))] #[no_mangle] @@ -22,6 +22,8 @@ pub extern "C" fn _start() -> ! { pub fn panic(_info: &PanicInfo) -> ! { serial_println!("ok"); - unsafe { exit_qemu(); } + unsafe { + exit_qemu(); + } loop {} } diff --git a/src/lib.rs b/src/lib.rs index 0c1b49e0..8260af01 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -13,8 +13,8 @@ extern crate array_init; #[cfg(test)] extern crate std; -pub mod vga_buffer; pub mod serial; +pub mod vga_buffer; pub unsafe fn exit_qemu() { use x86_64::instructions::port::Port; diff --git a/src/main.rs b/src/main.rs index 7a96e4d6..80c2036c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -26,4 +26,4 @@ pub extern "C" fn _start() -> ! { pub fn panic(info: &PanicInfo) -> ! { println!("{}", info); loop {} -} \ No newline at end of file +} diff --git a/src/serial.rs b/src/serial.rs index 0ce097c1..3cd4817f 100644 --- a/src/serial.rs +++ b/src/serial.rs @@ -1,5 +1,5 @@ -use uart_16550::SerialPort; use spin::Mutex; +use uart_16550::SerialPort; lazy_static! { pub static ref SERIAL1: Mutex = { @@ -11,7 +11,10 @@ lazy_static! { pub fn print(args: ::core::fmt::Arguments) { use core::fmt::Write; - SERIAL1.lock().write_fmt(args).expect("Printing to serial failed"); + SERIAL1 + .lock() + .write_fmt(args) + .expect("Printing to serial failed"); } /// Prints to the host through the serial interface. @@ -28,4 +31,4 @@ macro_rules! serial_println { () => (serial_print!("\n")); ($fmt:expr) => (serial_print!(concat!($fmt, "\n"))); ($fmt:expr, $($arg:tt)*) => (serial_print!(concat!($fmt, "\n"), $($arg)*)); -} \ No newline at end of file +}