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
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());
}
let output = generator::generate(condensed);
let mut file = std::fs::File::create(out_file).expect("create 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,
globals,
structs: _,
path,
imports,
path: _,
imports: _,
} = prog;
asm.add(".intel_syntax noprefix");

1
src/main.rs

@ -27,7 +27,6 @@ mod command;
mod generator;
mod lexer;
mod parser;
mod table;
#[cfg(test)]
mod tests;
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