misc: clippy fixes
This commit is contained in:
@@ -108,10 +108,10 @@ impl Parser {
|
||||
let dest = expect_type!(self.next()?, Register)?;
|
||||
|
||||
let mut offset = Token::Immediate(0);
|
||||
if let Ok(next) = self.peek_next() {
|
||||
if expect_type!(next, Immediate).is_ok() {
|
||||
offset = self.next()?;
|
||||
}
|
||||
if let Ok(next) = self.peek_next()
|
||||
&& expect_type!(next, Immediate).is_ok()
|
||||
{
|
||||
offset = self.next()?;
|
||||
}
|
||||
|
||||
args = vec![base, dest, offset];
|
||||
@@ -120,10 +120,10 @@ impl Parser {
|
||||
let base = expect_type!(self.next()?, Register)?;
|
||||
let dest = expect_type!(self.next()?, Register, Symbol)?;
|
||||
let mut offset = Token::Immediate(0);
|
||||
if let Ok(next) = self.peek_next() {
|
||||
if expect_type!(next, Immediate).is_ok() {
|
||||
offset = self.next()?;
|
||||
}
|
||||
if let Ok(next) = self.peek_next()
|
||||
&& expect_type!(next, Immediate).is_ok()
|
||||
{
|
||||
offset = self.next()?;
|
||||
}
|
||||
args = vec![base, dest, offset];
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ fn main() {
|
||||
let mut output_file = match fs::File::create(output_path) {
|
||||
Ok(file) => file,
|
||||
Err(e) => {
|
||||
eprintln!("Failed to create output file: {}", e);
|
||||
eprintln!("Failed to create output file: {e}");
|
||||
std::process::exit(1);
|
||||
}
|
||||
};
|
||||
@@ -33,7 +33,7 @@ fn main() {
|
||||
|
||||
// Assemble the source file
|
||||
if let Err(e) = engine.assemble(&src) {
|
||||
eprintln!("Assembly error: {}", e);
|
||||
eprintln!("Assembly error: {e}");
|
||||
std::process::exit(1);
|
||||
}
|
||||
|
||||
@@ -43,13 +43,13 @@ fn main() {
|
||||
for instruction in instructions {
|
||||
if let Err(e) = output_file.write_all(&instruction.encode().to_le_bytes())
|
||||
{
|
||||
eprintln!("Failed to write to output file: {}", e);
|
||||
eprintln!("Failed to write to output file: {e}");
|
||||
std::process::exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
Some(Err(e)) => {
|
||||
eprintln!("Build error: {}", e);
|
||||
eprintln!("Build error: {e}");
|
||||
std::process::exit(1);
|
||||
}
|
||||
None => {
|
||||
|
||||
@@ -20,7 +20,7 @@ pub fn tool_libcreate() {
|
||||
_ => panic!("Invalid project type"),
|
||||
};
|
||||
|
||||
let path = format!("{}/{}.dsa", project_path, project_name);
|
||||
let path = format!("{project_path}/{project_name}.dsa");
|
||||
std::fs::write(path, template).expect("Unable to write file");
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ pub mod logging;
|
||||
use std::io::Write;
|
||||
|
||||
pub fn input(prompt: &str) -> String {
|
||||
print!("{}\n > ", prompt);
|
||||
print!("{prompt}\n > ");
|
||||
std::io::stdout().flush().unwrap();
|
||||
let mut input = String::new();
|
||||
std::io::stdin().read_line(&mut input).unwrap();
|
||||
|
||||
Reference in New Issue
Block a user