Skip to content

Commit

Permalink
Fixed Clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
fegge committed Jun 20, 2024
1 parent 791b50c commit 72c3705
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
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
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
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

0 comments on commit 72c3705

Please sign in to comment.