Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
dark64 committed Oct 23, 2023
1 parent be2f8e2 commit 8620929
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 24 deletions.
3 changes: 3 additions & 0 deletions zokrates_ast/src/common/flat/parameter.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// see https://github.com/mcarton/rust-derivative/issues/115
#![allow(clippy::incorrect_partial_ord_impl_on_ord_type)]

use crate::common::{Span, WithSpan};

use super::variable::Variable;
Expand Down
2 changes: 1 addition & 1 deletion zokrates_ast/src/ir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ impl<T: Field> fmt::Display for ConstraintStatement<T> {
self.error
.as_ref()
.map(|e| format!(" // {}", e))
.unwrap_or_else(|| "".to_string())
.unwrap_or_default()
)
}
}
Expand Down
2 changes: 1 addition & 1 deletion zokrates_ast/src/typed/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ impl<'ast> PartialEq for GenericIdentifier<'ast> {

impl<'ast> PartialOrd for GenericIdentifier<'ast> {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
self.index.partial_cmp(&other.index)
Some(self.cmp(other))
}
}

Expand Down
7 changes: 2 additions & 5 deletions zokrates_ast/src/untyped/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -543,11 +543,8 @@ impl<'ast> fmt::Display for Range<'ast> {
self.from
.as_ref()
.map(|e| e.to_string())
.unwrap_or_else(|| "".to_string()),
self.to
.as_ref()
.map(|e| e.to_string())
.unwrap_or_else(|| "".to_string())
.unwrap_or_default(),
self.to.as_ref().map(|e| e.to_string()).unwrap_or_default()
)
}
}
Expand Down
5 changes: 1 addition & 4 deletions zokrates_cli/src/ops/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,7 @@ fn cli_check<T: Field>(sub_matches: &ArgMatches) -> Result<(), String> {
check::<T, _>(source, path, Some(&resolver), &config).map_err(|e| {
format!(
"Check failed:\n\n{}",
e.0.iter()
.map(|e| fmt_error(e))
.collect::<Vec<_>>()
.join("\n\n")
e.0.iter().map(fmt_error).collect::<Vec<_>>().join("\n\n")
)
})?;

Expand Down
5 changes: 1 addition & 4 deletions zokrates_cli/src/ops/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,7 @@ fn cli_compile<T: Field>(sub_matches: &ArgMatches) -> Result<(), String> {
.map_err(|e| {
format!(
"Compilation failed:\n\n{}",
e.0.iter()
.map(|e| fmt_error(e))
.collect::<Vec<_>>()
.join("\n\n")
e.0.iter().map(fmt_error).collect::<Vec<_>>().join("\n\n")
)
})?;

Expand Down
4 changes: 2 additions & 2 deletions zokrates_interpreter/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,8 @@ impl Interpreter {
let s = x.to_dec_string();
<Bn256 as ScalarEngine>::Fr::from_str(&s).unwrap()
};
let i: Vec<_> = i.iter().map(|x| to_fr(x)).collect();
let h: Vec<_> = h.iter().map(|x| to_fr(x)).collect();
let i: Vec<_> = i.iter().map(to_fr).collect();
let h: Vec<_> = h.iter().map(to_fr).collect();
assert_eq!(h.len(), 256);
generate_sha256_round_witness::<Bn256>(&i, &h)
.into_iter()
Expand Down
8 changes: 1 addition & 7 deletions zokrates_js/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,13 +276,7 @@ mod internal {
&arena,
)
.map_err(|ce| {
JsValue::from_str(
&ce.0
.iter()
.map(|e| fmt_error(e))
.collect::<Vec<_>>()
.join("\n"),
)
JsValue::from_str(&ce.0.iter().map(fmt_error).collect::<Vec<_>>().join("\n"))
})?;

let abi = artifacts.abi().clone();
Expand Down

0 comments on commit 8620929

Please sign in to comment.