Skip to content

Commit b73f3d6

Browse files
committed
Remove duplicated contains_key test
1 parent e9c2803 commit b73f3d6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

compiler/src/symboltable.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,8 @@ impl SymbolTableBuilder {
710710
let location = Default::default();
711711

712712
// Some checks:
713-
if table.symbols.contains_key(name) {
713+
let containing = table.symbols.contains_key(name);
714+
if containing {
714715
// Role already set..
715716
match role {
716717
SymbolUsage::Global => {
@@ -747,7 +748,7 @@ impl SymbolTableBuilder {
747748
}
748749

749750
// Insert symbol when required:
750-
if !table.symbols.contains_key(name) {
751+
if !containing {
751752
let symbol = Symbol::new(name);
752753
table.symbols.insert(name.to_string(), symbol);
753754
}

0 commit comments

Comments
 (0)