mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-12-25 11:12:48 +03:00
clippy changes
This commit is contained in:
parent
444a4214eb
commit
e149f7d35f
@ -319,7 +319,8 @@ impl<'a> Compiler<'a> {
|
||||
fn write_symbol_table_to_json(&self, file_suffix: &str, symbol_table: &SymbolTable) -> Result<()> {
|
||||
// Remove `Span`s if they are not enabled.
|
||||
if self.compiler_options.output.symbol_table_spans_enabled {
|
||||
symbol_table.to_json_file(self.output_directory.clone(), &format!("{}.{file_suffix}", self.program_name))?;
|
||||
symbol_table
|
||||
.to_json_file(self.output_directory.clone(), &format!("{}.{file_suffix}", self.program_name))?;
|
||||
} else {
|
||||
symbol_table.to_json_file_without_keys(
|
||||
self.output_directory.clone(),
|
||||
|
@ -22,13 +22,13 @@ pub use variable_symbol::*;
|
||||
|
||||
use std::cell::RefCell;
|
||||
|
||||
use leo_ast::{Function, Struct, remove_key_from_json, normalize_json_value};
|
||||
use leo_ast::{normalize_json_value, remove_key_from_json, Function, Struct};
|
||||
use leo_errors::{AstError, Result};
|
||||
use leo_span::{Span, Symbol};
|
||||
|
||||
use indexmap::IndexMap;
|
||||
use serde_json;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json;
|
||||
|
||||
#[derive(Clone, Debug, Default, Serialize, Deserialize)]
|
||||
pub struct SymbolTable {
|
||||
@ -204,7 +204,8 @@ impl SymbolTable {
|
||||
excluded_keys: &[&str],
|
||||
) -> Result<()> {
|
||||
path.push(file_name);
|
||||
let file = std::fs::File::create(&path).map_err(|e| AstError::failed_to_create_symbol_table_json_file(&path, &e))?;
|
||||
let file =
|
||||
std::fs::File::create(&path).map_err(|e| AstError::failed_to_create_symbol_table_json_file(&path, &e))?;
|
||||
let writer = std::io::BufWriter::new(file);
|
||||
|
||||
let mut value = self.to_json_value().unwrap();
|
||||
@ -219,7 +220,8 @@ impl SymbolTable {
|
||||
|
||||
/// Deserializes the JSON string into a symbol table.
|
||||
pub fn from_json_string(json: &str) -> Result<Self> {
|
||||
let symbol_table: SymbolTable = serde_json::from_str(json).map_err(|e| AstError::failed_to_read_json_string_to_symbol_table(&e))?;
|
||||
let symbol_table: SymbolTable =
|
||||
serde_json::from_str(json).map_err(|e| AstError::failed_to_read_json_string_to_symbol_table(&e))?;
|
||||
Ok(symbol_table)
|
||||
}
|
||||
|
||||
@ -228,6 +230,4 @@ impl SymbolTable {
|
||||
let data = std::fs::read_to_string(&path).map_err(|e| AstError::failed_to_read_json_file(&path, &e))?;
|
||||
Self::from_json_string(&data)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user