assembler: purge unwrap and use more AssembleErrors
This commit is contained in:
@@ -5,11 +5,12 @@ use std::{fmt, sync::mpsc::Sender};
|
||||
pub struct Logger {}
|
||||
|
||||
impl Logger {
|
||||
pub fn new() -> Self {
|
||||
pub const fn new() -> Self {
|
||||
Self {}
|
||||
}
|
||||
|
||||
pub fn log(&self, message: &str) {
|
||||
_ = self;
|
||||
println!("\x1b[32mINFO:\x1b[0m {message}");
|
||||
}
|
||||
}
|
||||
@@ -90,11 +91,11 @@ impl fmt::Display for EntryType {
|
||||
f,
|
||||
"{:<5}",
|
||||
match self {
|
||||
EntryType::Debug => "DEBUG",
|
||||
EntryType::Info => "INFO",
|
||||
EntryType::Warn => "WARN",
|
||||
EntryType::Error => "ERROR",
|
||||
EntryType::Fatal => "FATAL",
|
||||
Self::Debug => "DEBUG",
|
||||
Self::Info => "INFO",
|
||||
Self::Warn => "WARN",
|
||||
Self::Error => "ERROR",
|
||||
Self::Fatal => "FATAL",
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
@@ -4,8 +4,10 @@ use std::io::Write;
|
||||
|
||||
pub fn input(prompt: &str) -> String {
|
||||
print!("{prompt}\n > ");
|
||||
std::io::stdout().flush().unwrap();
|
||||
std::io::stdout().flush().expect("Failed to flush stdout");
|
||||
let mut input = String::new();
|
||||
std::io::stdin().read_line(&mut input).unwrap();
|
||||
std::io::stdin()
|
||||
.read_line(&mut input)
|
||||
.expect("Failed to read line from stdin");
|
||||
input.trim().to_string()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user