mirror of
https://github.com/RustPython/Parser.git
synced 2025-07-14 16:45:25 +00:00
Fix some clippy lints that were 'allow'ed
This commit is contained in:
parent
1e12aa8afe
commit
c27abf862f
1 changed files with 5 additions and 8 deletions
|
@ -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!
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue