Skip to content

Commit 3d1cec1

Browse files
committed
lint & fmt
1 parent ba288c3 commit 3d1cec1

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

witnesscalc_adapter/src/convert_type.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ use num_bigint::BigInt;
44
use num_traits::FromBytes;
55

66
pub fn parse_witness_to<T>(
7-
buffer: &[u8],
8-
from_le_bytes: impl Fn(&[u8]) -> T,
7+
buffer: &[u8],
8+
from_le_bytes: impl Fn(&[u8]) -> T,
99
) -> io::Result<Vec<T>> {
1010
/// Prints to the standard ouput only in debug build.
1111
macro_rules! debug_println {
@@ -15,13 +15,13 @@ pub fn parse_witness_to<T>(
1515
let mut pos = 0;
1616

1717
// skip format bytes (4 bytes)
18-
// ensure that this says "wtns" in ASCII
19-
if &buffer[pos..pos + 4] != b"wtns" {
20-
return Err(io::Error::new(
21-
io::ErrorKind::InvalidData,
22-
"Invalid witness file format.",
23-
));
24-
}
18+
// ensure that this says "wtns" in ASCII
19+
if &buffer[pos..pos + 4] != b"wtns" {
20+
return Err(io::Error::new(
21+
io::ErrorKind::InvalidData,
22+
"Invalid witness file format.",
23+
));
24+
}
2525
pos += 4;
2626

2727
// read version (4 bytes)
@@ -67,7 +67,7 @@ pub fn parse_witness_to<T>(
6767

6868
let _n_witness_values =
6969
u32::from_le_bytes(buffer[pos..pos + 4].try_into().unwrap());
70-
debug_println!("n_witness_values: {}", _n_witness_values);
70+
debug_println!("n_witness_values: {}", _n_witness_values);
7171
pos += 4;
7272
}
7373

@@ -84,7 +84,7 @@ pub fn parse_witness_to<T>(
8484
}
8585
// skip any other section
8686
_ => {
87-
pos = pos + section_length as usize;
87+
pos += section_length as usize;
8888
}
8989
}
9090
}

witnesscalc_adapter/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ pub fn build_and_link(circuits_dir: &str) {
9393
if !Path::is_dir(Path::new(circuits_dir)) {
9494
panic!("circuits_dir must be a directory");
9595
}
96-
println!("cargo:rerun-if-changed={}", circuits_dir.to_string());
96+
println!("cargo:rerun-if-changed={}", circuits_dir);
9797

9898
let witnesscalc_path = Path::new(&out_dir).join(Path::new("witnesscalc"));
9999
// If the witnesscalc repo is not cloned, clone it
@@ -175,7 +175,7 @@ pub fn build_and_link(circuits_dir: &str) {
175175
let circuit_dat_dest = witnesscalc_path.join("src").join(circuit_dat_name);
176176
fs::copy(&circuit_dat, &circuit_dat_dest).expect("Failed to copy circuit .dat file");
177177
//For each .cpp file, do the following: find the last include statement (should be #include "calcwit.hpp") and insert the following on the next line: namespace CIRCUIT_NAME {. Then, insert the closing } at the end of the file:
178-
let circuit_cpp = fs::read_to_string(&path).expect("Failed to read circuit .cpp file");
178+
let circuit_cpp = fs::read_to_string(path).expect("Failed to read circuit .cpp file");
179179
let circuit_cpp = circuit_cpp.replace(
180180
"#include \"calcwit.hpp\"",
181181
"#include \"calcwit.hpp\"\nnamespace CIRCUIT_NAME {",
@@ -264,7 +264,7 @@ fn android() {
264264
"Error: Source file {:?} does not exist",
265265
lib_path
266266
);
267-
let dest_dir = Path::new(&output_path).join(&env::var("CARGO_NDK_ANDROID_TARGET").unwrap());
267+
let dest_dir = Path::new(&output_path).join(env::var("CARGO_NDK_ANDROID_TARGET").unwrap());
268268
println!("cargo:rerun-if-changed={}", dest_dir.display());
269269
if !dest_dir.exists() {
270270
fs::create_dir_all(&dest_dir).unwrap();

0 commit comments

Comments
 (0)