Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linter fixes #22

Merged
merged 2 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
597 changes: 260 additions & 337 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
[workspace]
resolver = "1"

members = [
"cli",
"parser",
Expand Down
4 changes: 2 additions & 2 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "circomspect"
version = "0.8.1"
version = "0.9.0"
edition = "2021"
rust-version = "1.65"
license = "LGPL-3.0-only"
Expand All @@ -17,7 +17,7 @@ atty = "0.2"
clap = { version = "3.2", features = ["derive"] }
log = "0.4"
parser = { package = "circomspect-parser", version = "2.1.3", path = "../parser" }
pretty_env_logger = "0.4"
pretty_env_logger = "0.5"
program_analysis = { package = "circomspect-program-analysis", version = "0.8.1", path = "../program_analysis" }
program_structure = { package = "circomspect-program-structure", version = "2.1.3", path = "../program_structure" }
serde_json = "1.0"
Expand Down
14 changes: 7 additions & 7 deletions parser/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "circomspect-parser"
version = "2.1.3"
version = "2.2.0"
edition = "2021"
rust-version = "1.65"
build = "build.rs"
Expand All @@ -14,14 +14,14 @@ authors = [

[build-dependencies]
rustc-hex = "2.0"
lalrpop = { version = "0.19", features = ["lexer"] }
num-bigint-dig = "0.6"
lalrpop = { version = "0.20", features = ["lexer"] }
num-bigint-dig = "0.8"
num-traits = "0.2"

[dependencies]
program_structure = { package = "circomspect-program-structure", version = "2.1.3", path = "../program_structure" }
lalrpop = { version = "0.19", features = ["lexer"] }
lalrpop-util = "0.19"
program_structure = { package = "circomspect-program-structure", version = "2.1.4", path = "../program_structure" }
lalrpop = { version = "0.20", features = ["lexer"] }
lalrpop-util = "0.20"
log = "0.4"
regex = "1.7"
rustc-hex = "2.1"
Expand All @@ -31,4 +31,4 @@ serde = "1.0"
serde_derive = "1.0"

[dev-dependencies]
program_structure = { package = "circomspect-program-structure", version = "2.1.3", path = "../program_structure" }
program_structure = { package = "circomspect-program-structure", version = "2.1.4", path = "../program_structure" }
2 changes: 1 addition & 1 deletion parser/src/include_logic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ impl FileStack {
} else {
// only match include paths with a single component i.e. lib.circom and not dir/lib.circom or
// ./lib.circom
if include.path.find(std::path::MAIN_SEPARATOR) == None {
if include.path.find(std::path::MAIN_SEPARATOR).is_none() {
debug!("checking if `{}` matches `{}`", include.path, lib.path.display());
if lib.path.file_name().expect("good library file") == pathos {
debug!("adding include `{}` from file", lib.path.display());
Expand Down
2 changes: 1 addition & 1 deletion parser/src/syntax_sugar_remover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ fn remove_anonymous_from_expression(
}
}
} else {
new_signals = signals.clone();
new_signals.clone_from(&signals);
for _ in 0..signals.len() {
new_operators.push(AssignOp::AssignConstraintSignal);
}
Expand Down
10 changes: 5 additions & 5 deletions program_analysis/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "circomspect-program-analysis"
version = "0.8.1"
version = "0.8.2"
edition = "2021"
rust-version = "1.65"
license = "LGPL-3.0-only"
Expand All @@ -14,9 +14,9 @@ log = "0.4"
num-bigint-dig = "0.8"
num-traits = "0.2"
thiserror = "1.0"
parser = { package = "circomspect-parser", version = "2.1.3", path = "../parser" }
program_structure = { package = "circomspect-program-structure", version = "2.1.3", path = "../program_structure" }
parser = { package = "circomspect-parser", version = "2.2.0", path = "../parser" }
program_structure = { package = "circomspect-program-structure", version = "2.1.4", path = "../program_structure" }

[dev-dependencies]
parser = { package = "circomspect-parser", version = "2.1.3", path = "../parser" }
program_structure = { package = "circomspect-program-structure", version = "2.1.3", path = "../program_structure" }
parser = { package = "circomspect-parser", version = "2.2.0", path = "../parser" }
program_structure = { package = "circomspect-program-structure", version = "2.1.4", path = "../program_structure" }
8 changes: 4 additions & 4 deletions program_analysis/src/analysis_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ impl AnalysisRunner {
fn cache_template(&mut self, name: &str) -> Result<&Cfg, AnalysisError> {
if !self.template_cfgs.contains_key(name) {
// The template CFG needs to be generated from the AST.
if self.template_reports.get(name).is_some() {
if self.template_reports.contains_key(name) {
// We have already failed to generate the CFG.
return Err(AnalysisError::FailedToLiftTemplate { name: name.to_string() });
}
Expand All @@ -243,7 +243,7 @@ impl AnalysisRunner {
fn cache_function(&mut self, name: &str) -> Result<&Cfg, AnalysisError> {
if !self.function_cfgs.contains_key(name) {
// The function CFG needs to be generated from the AST.
if self.function_reports.get(name).is_some() {
if self.function_reports.contains_key(name) {
// We have already failed to generate the CFG.
return Err(AnalysisError::FailedToLiftFunction { name: name.to_string() });
}
Expand Down Expand Up @@ -289,11 +289,11 @@ impl AnalysisRunner {

impl AnalysisContext for AnalysisRunner {
fn is_template(&self, name: &str) -> bool {
self.template_asts.get(name).is_some()
self.template_asts.contains_key(name)
}

fn is_function(&self, name: &str) -> bool {
self.function_asts.get(name).is_some()
self.function_asts.contains_key(name)
}

fn template(&mut self, name: &str) -> Result<&Cfg, AnalysisError> {
Expand Down
4 changes: 2 additions & 2 deletions program_structure/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "circomspect-program-structure"
version = "2.1.3"
version = "2.1.4"
edition = "2021"
rust-version = "1.65"
license = "LGPL-3.0-only"
Expand All @@ -24,7 +24,7 @@ num-bigint-dig = "0.8"
num-traits = "0.2"
serde = "1.0"
serde_derive = "1.0"
serde-sarif = "0.3"
serde-sarif = "0.4"
serde_json = "1.0"
thiserror = "1.0"
termcolor = "1.1.3"
Expand Down
12 changes: 6 additions & 6 deletions program_structure/src/program_library/report.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use anyhow::anyhow;
use std::cmp::Ordering;
use std::fmt::Display;
use std::str::FromStr;

use codespan_reporting::diagnostic::{Diagnostic, Label};
Expand Down Expand Up @@ -44,15 +45,14 @@ impl Ord for MessageCategory {
}
}

impl ToString for MessageCategory {
fn to_string(&self) -> String {
impl Display for MessageCategory {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
use MessageCategory::*;
match self {
Error => "error",
Warning => "warning",
Info => "info",
Error => write!(f, "error"),
Warning => write!(f, "warning"),
Info => write!(f, "info"),
}
.to_string()
}
}

Expand Down
Loading