fix noop method call warnings

This commit is contained in:
collin 2023-08-18 16:16:55 -07:00
parent 0cccdda67e
commit cf9fbb319d
3 changed files with 5 additions and 6 deletions

View File

@ -458,7 +458,7 @@ impl<'a> CodeGenerator<'a> {
Expression::Identifier(identifier) => identifier.name,
_ => unreachable!("Parsing guarantees that a function name is always an identifier."),
};
let return_type = &self.symbol_table.borrow().lookup_fn_symbol(function_name).unwrap().output_type;
let return_type = &self.symbol_table.lookup_fn_symbol(function_name).unwrap().output_type;
match return_type {
Type::Unit => {
call_instruction.push(';');

View File

@ -175,7 +175,7 @@ impl StatementReconstructor for Flattener<'_> {
_ => unreachable!("Parsing guarantees that `function` is an identifier."),
};
let function = self.symbol_table.borrow().lookup_fn_symbol(function_name).unwrap();
let function = self.symbol_table.lookup_fn_symbol(function_name).unwrap();
match &function.output_type {
// If the function returns a tuple, reconstruct the assignment and add an entry to `self.tuples`.
Type::Tuple(tuple) => {
@ -256,7 +256,7 @@ impl StatementReconstructor for Flattener<'_> {
Expression::Identifier(identifier) => {
// Retrieve the entry in the symbol table for the mapping.
// Note that this unwrap is safe since type checking ensures that the mapping exists.
let variable = self.symbol_table.borrow().lookup_variable(identifier.name).unwrap();
let variable = self.symbol_table.lookup_variable(identifier.name).unwrap();
match &variable.type_ {
Type::Mapping(mapping_type) => &*mapping_type.value,
_ => unreachable!("Type checking guarantee that `arguments[0]` is a mapping."),
@ -292,7 +292,7 @@ impl StatementReconstructor for Flattener<'_> {
_ => unreachable!("Parsing guarantees that `function` is an identifier."),
};
let function = self.symbol_table.borrow().lookup_fn_symbol(function_name).unwrap();
let function = self.symbol_table.lookup_fn_symbol(function_name).unwrap();
let output_type = match &function.output_type {
Type::Tuple(tuple) => tuple.clone(),

View File

@ -40,7 +40,6 @@ use leo_ast::{
use leo_span::{sym, Symbol};
use indexmap::IndexMap;
use std::borrow::Borrow;
impl ExpressionConsumer for StaticSingleAssigner<'_> {
type Output = (Expression, Vec<Statement>);
@ -212,7 +211,7 @@ impl ExpressionConsumer for StaticSingleAssigner<'_> {
// Lookup the struct definition.
// Note that type checking guarantees that the correct struct definition exists.
let struct_definition: &Struct = self.symbol_table.borrow().lookup_struct(input.name.name).unwrap();
let struct_definition: &Struct = self.symbol_table.lookup_struct(input.name.name).unwrap();
// Initialize the list of reordered members.
let mut reordered_members = Vec::with_capacity(members.len());