diff --git a/build.rs b/build.rs index 2bf51d40ab..6bcdcf8f46 100644 --- a/build.rs +++ b/build.rs @@ -43,16 +43,17 @@ fn compare_license_text(path: &Path, expected_lines: &[&str]) { let reader = BufReader::new(file); for (i, (file_line, expected_line)) in reader.lines().zip(expected_lines).enumerate() { - let file_line = file_line.expect(&format!("Can't read line {} in file \"{}\"!", i + 1, path.display())); - - assert!( - &file_line == expected_line, + let file_line = + file_line.unwrap_or_else(|_| panic!("Can't read line {} in file \"{}\"!", i + 1, path.display())); + assert_eq!( + &file_line, + expected_line, "Line {} in file \"{}\" was expected to contain the license text \"{}\", but contains \"{}\" instead! \ Consult the expected license text in \".resources/license_header\"", i + 1, path.display(), expected_line, - file_line, + file_line ); } } @@ -75,7 +76,7 @@ fn check_file_licenses>(path: P) { // Check all files with the ".rs" extension. if entry_type.is_file() && entry.file_name().to_str().unwrap_or("").ends_with(".rs") { - compare_license_text(&entry.path(), &license_lines); + compare_license_text(entry.path(), &license_lines); } } diff --git a/compiler/passes/src/symbol_table/table.rs b/compiler/passes/src/symbol_table/table.rs index 9eec03d92c..31c3b570aa 100644 --- a/compiler/passes/src/symbol_table/table.rs +++ b/compiler/passes/src/symbol_table/table.rs @@ -53,7 +53,7 @@ impl SymbolTable { } else if let Some(existing) = self.circuits.get(&symbol) { match existing.is_record { true => Err(AstError::shadowed_record(symbol, span).into()), - false => Err(AstError::shadowed_circuit(symbol, span).into()) + false => Err(AstError::shadowed_circuit(symbol, span).into()), } } else if let Some(parent) = self.parent.as_ref() { parent.check_shadowing(symbol, span)