&str::to_string -> &str::to_owned for variables

This commit is contained in:
Jeong YunWon 2020-02-05 22:03:36 +09:00
parent 7860fc877d
commit 04c29f384e
2 changed files with 21 additions and 21 deletions

View file

@ -105,7 +105,7 @@ pub struct Symbol {
impl Symbol {
fn new(name: &str) -> Self {
Symbol {
name: name.to_string(),
name: name.to_owned(),
// table,
scope: SymbolScope::Unknown,
is_param: false,
@ -304,7 +304,7 @@ impl SymbolTableBuilder {
}
fn enter_scope(&mut self, name: &str, typ: SymbolTableType, line_number: usize) {
let table = SymbolTable::new(name.to_string(), typ, line_number);
let table = SymbolTable::new(name.to_owned(), typ, line_number);
self.tables.push(table);
}
@ -793,7 +793,7 @@ impl SymbolTableBuilder {
// Insert symbol when required:
if !containing {
let symbol = Symbol::new(name);
table.symbols.insert(name.to_string(), symbol);
table.symbols.insert(name.to_owned(), symbol);
}
// Set proper flags on symbol: