Fmt, clippy

This commit is contained in:
Pranav Gaddamadugu 2022-07-06 16:16:19 -07:00
parent 12eafa4174
commit 9b7d9a96b7
2 changed files with 8 additions and 7 deletions

View File

@ -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<P: AsRef<Path>>(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);
}
}

View File

@ -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)