kernel: debug: fix remaining clippy lints

Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
Sean Cross 2021-08-06 11:34:30 +08:00
parent c7ff0ceb21
commit 08b787a03e

View file

@ -28,6 +28,7 @@ pub use crate::debug::debug_print_hardware::SUPERVISOR_UART_ADDR;
#[macro_export] #[macro_export]
macro_rules! print { macro_rules! print {
($($args:tt)+) => {{ ($($args:tt)+) => {{
#[allow(unused_unsafe)]
unsafe { unsafe {
if let Some(mut stream) = crate::debug::DEBUG_OUTPUT.as_mut() { if let Some(mut stream) = crate::debug::DEBUG_OUTPUT.as_mut() {
write!(&mut stream, $($args)+).unwrap(); write!(&mut stream, $($args)+).unwrap();
@ -75,9 +76,7 @@ impl Uart {
let mut uart_csr = CSR::new(crate::debug::SUPERVISOR_UART_ADDR as *mut u32); let mut uart_csr = CSR::new(crate::debug::SUPERVISOR_UART_ADDR as *mut u32);
// Wait until TXFULL is `0` // Wait until TXFULL is `0`
while uart_csr.r(utra::uart::TXFULL) != 0 { while uart_csr.r(utra::uart::TXFULL) != 0 {}
()
}
#[cfg(feature = "wrap-print")] #[cfg(feature = "wrap-print")]
unsafe { unsafe {
if c == b'\n' { if c == b'\n' {
@ -129,13 +128,11 @@ impl gdbstub::Connection for Uart {
fn write(&mut self, byte: u8) -> Result<(), Self::Error> { fn write(&mut self, byte: u8) -> Result<(), Self::Error> {
if unsafe { DEBUG_OUTPUT.is_none() } { if unsafe { DEBUG_OUTPUT.is_none() } {
Err(())?; return Err(());
} }
let mut uart_csr = CSR::new(crate::debug::SUPERVISOR_UART_ADDR as *mut u32); let mut uart_csr = CSR::new(crate::debug::SUPERVISOR_UART_ADDR as *mut u32);
// Wait until TXFULL is not `0` // Wait until TXFULL is not `0`
while uart_csr.r(utra::uart::TXFULL) != 0 { while uart_csr.r(utra::uart::TXFULL) != 0 {}
()
}
uart_csr.wo(utra::uart::RXTX, byte as u32); uart_csr.wo(utra::uart::RXTX, byte as u32);
Ok(()) Ok(())
} }
@ -305,7 +302,5 @@ macro_rules! klog
#[cfg(not(feature = "debug-print"))] #[cfg(not(feature = "debug-print"))]
#[macro_export] #[macro_export]
macro_rules! klog { macro_rules! klog {
($($args:tt)+) => {{ ($($args:tt)+) => {{}};
()
}};
} }