diff --git a/src/main.rs b/src/main.rs index 65032a7..9edb07d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -130,12 +130,11 @@ fn main() { // get config let mut config = Config::get_default(); - for k in parsed_config.keys() { - if let Value::Table(t) = parsed_config.get(k).unwrap() { - if k == "config" { - config.set(&t); - break; - } + if let Some(v) = parsed_config.get("config") { + if let Value::Table(t) = v { + config.set(&t); + } else { + panic!("error parsing config table: config invalid type, must be a table."); } } //---- @@ -212,7 +211,7 @@ rule regen_compile_commands build $builddir: mkdir -build $builddir/compile_commands.json: regen_compile_commands {config_file_name} | $builddir +build $builddir/compile_commands.json: regen_compile_commands {config_file_name} || $builddir pool = console build {output_file}: regen_ninjafile {config_file_name} || $builddir/compile_commands.json