~garritfra/antimony

0df25445396860232883a83986d51d564d96e816 — Garrit Franke 5 months ago 4f85116
fix: clippy warnings
3 files changed, 5 insertions(+), 7 deletions(-)

M src/builder/mod.rs
M src/generator/mod.rs
M src/parser/infer.rs
M src/builder/mod.rs => src/builder/mod.rs +1 -1
@@ 134,7 134,7 @@ impl Builder {
        let output = match target {
            Target::JS => generator::js::JsGenerator::generate(condensed),
            Target::C => generator::c::CGenerator::generate(condensed),
            Target::LLVM => {
            Target::Llvm => {
                #[cfg(not(feature = "llvm"))]
                panic!("'llvm' feature should be enabled to use LLVM target");


M src/generator/mod.rs => src/generator/mod.rs +2 -2
@@ 29,7 29,7 @@ pub mod x86;
pub enum Target {
    C,
    JS,
    LLVM,
    Llvm,
    X86,
}



@@ 57,7 57,7 @@ impl FromStr for Target {
        match s.as_str() {
            "c" => Ok(Target::C),
            "js" => Ok(Target::JS),
            "llvm" => Ok(Target::LLVM),
            "llvm" => Ok(Target::Llvm),
            "x86" => Ok(Target::X86),
            _ => Err(format!("no target {} found", s)),
        }

M src/parser/infer.rs => src/parser/infer.rs +2 -4
@@ 64,10 64,7 @@ fn infer_array(elements: &[Expression], table: &SymbolTable) -> Option<Type> {

    // TODO: This approach only relies on the first element.
    // It will not catch that types are possibly inconsistent.
    match types.first().and_then(|ty| ty.to_owned()) {
        Some(ty) => Some(Type::Array(Box::new(ty), Some(types.len()))),
        None => None,
    }
    types.first().and_then(|ty| ty.to_owned()).map(|ty| Type::Array(Box::new(ty), Some(types.len())))
}

fn infer_function_call(name: &str, table: &SymbolTable) -> Option<Type> {


@@ 76,3 73,4 @@ fn infer_function_call(name: &str, table: &SymbolTable) -> Option<Type> {
        None => None,
    }
}