Fix some clippy lints that were 'allow'ed

This commit is contained in:
Noah 2020-03-16 20:56:45 -05:00
parent 1e12aa8afe
commit c27abf862f

View file

@ -741,7 +741,6 @@ impl SymbolTableBuilder {
Ok(()) Ok(())
} }
#[allow(clippy::single_match)]
fn register_name(&mut self, name: &str, role: SymbolUsage) -> SymbolTableResult { fn register_name(&mut self, name: &str, role: SymbolUsage) -> SymbolTableResult {
let scope_depth = self.tables.len(); let scope_depth = self.tables.len();
let table = self.tables.last_mut().unwrap(); let table = self.tables.last_mut().unwrap();
@ -777,13 +776,11 @@ impl SymbolTableBuilder {
// Some more checks: // Some more checks:
match role { match role {
SymbolUsage::Nonlocal => { SymbolUsage::Nonlocal if scope_depth < 2 => {
if scope_depth < 2 { return Err(SymbolTableError {
return Err(SymbolTableError { error: format!("cannot define nonlocal '{}' at top level.", name),
error: format!("cannot define nonlocal '{}' at top level.", name), location,
location, })
});
}
} }
_ => { _ => {
// Ok! // Ok!