Reduce nesting of match expression
@@ -1178,8 +1178,7 @@ impl SymbolTableBuilder {
let symbol = if let Some(symbol) = table.symbols.get_mut(name.as_ref()) {
// Role already set..
match role {
- SymbolUsage::Global => {
- if !symbol.is_global() {
+ SymbolUsage::Global if !symbol.is_global() => {
if symbol.is_parameter {
return Err(SymbolTableError {
error: format!("name '{}' is parameter and global", name),
@@ -1188,10 +1187,7 @@ impl SymbolTableBuilder {
}
if symbol.is_referenced {
return Err(SymbolTableError {
- error: format!(
- "name '{}' is used prior to global declaration",
- name
- ),
+ error: format!("name '{}' is used prior to global declaration", name),
location,
});
}
@@ -1211,7 +1207,6 @@ impl SymbolTableBuilder {
});
}
}
- }
SymbolUsage::Nonlocal => {
if symbol.is_parameter {
return Err(SymbolTableError {
