Browse Source

chore: fix clippy warnings

modules
Garrit Franke 3 years ago
parent
commit
e43db8e7f4
  1. 4
      src/builder/mod.rs
  2. 4
      src/generator/x86.rs
  3. 1
      src/main.rs
  4. 20
      src/table/mod.rs

4
src/builder/mod.rs

@ -65,13 +65,13 @@ impl Builder {
// TODO: We shouldn't clone here // TODO: We shouldn't clone here
let mut condensed = mod_iter.next().ok_or("No module specified")?.clone(); let mut condensed = mod_iter.next().ok_or("No module specified")?.clone();
while let Some(module) = mod_iter.next() { for module in mod_iter {
condensed.merge_with(module.clone()); condensed.merge_with(module.clone());
} }
let output = generator::generate(condensed); let output = generator::generate(condensed);
let mut file = std::fs::File::create(out_file).expect("create failed"); let mut file = std::fs::File::create(out_file).expect("create failed");
file.write_all(output.as_bytes()).expect("write failed"); file.write_all(output.as_bytes()).expect("write failed");
Ok(file.flush().expect("Could not flush file")) file.flush().map_err(|_| "Could not flush file".into())
} }
} }

4
src/generator/x86.rs

@ -61,8 +61,8 @@ impl X86Generator {
func, func,
globals, globals,
structs: _, structs: _,
path, path: _,
imports, imports: _,
} = prog; } = prog;
asm.add(".intel_syntax noprefix"); asm.add(".intel_syntax noprefix");

1
src/main.rs

@ -27,7 +27,6 @@ mod command;
mod generator; mod generator;
mod lexer; mod lexer;
mod parser; mod parser;
mod table;
#[cfg(test)] #[cfg(test)]
mod tests; mod tests;
mod util; mod util;

20
src/table/mod.rs

@ -1,20 +0,0 @@
use std::collections::HashMap;
use crate::parser::node_type::Function;
use crate::parser::node_type::Type;
pub struct Table {
types: Vec<Type>,
functions: HashMap<String, Function>,
modules: Vec<String>,
}
impl Table {
pub(crate) fn new() -> Self {
Self {
types: Vec::new(),
functions: HashMap::new(),
modules: Vec::new()
}
}
}
Loading…
Cancel
Save