Skip to content

Commit

Permalink
style: clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
cryptonemo committed Apr 9, 2024
1 parent 95f9a76 commit e1e2294
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 16 deletions.
4 changes: 2 additions & 2 deletions rust/src/bls/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ mod tests {

assert!(verified);

let message_sizes = vec![message.len()];
let message_sizes = [message.len()];
let flattened_messages = message;

let verified = hash_verify(
Expand All @@ -319,7 +319,7 @@ mod tests {
assert!(!not_verified);

// garbage verification
let different_digest = vec![0, 1, 2, 3, 4];
let different_digest = [0, 1, 2, 3, 4];
let not_verified = verify(
signature[..].into(),
different_digest[..].into(),
Expand Down
4 changes: 2 additions & 2 deletions rust/src/fvm/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ impl TryFrom<u32> for EngineVersion {
fn try_from(value: u32) -> Result<Self, Self::Error> {
match value {
16 | 17 => Ok(EngineVersion::V1),
18 | 19 | 20 => Ok(EngineVersion::V2),
18..=20 => Ok(EngineVersion::V2),
21 | 22 => Ok(EngineVersion::V3),
_ => return Err(anyhow!("network version not supported")),
_ => Err(anyhow!("network version not supported")),
}
}
}
Expand Down
1 change: 1 addition & 0 deletions rust/src/fvm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ mod externs;

pub mod engine;
pub mod machine;
#[allow(clippy::incorrect_clone_impl_on_copy_type)]
pub mod types;

pub use cgo::FvmError;
24 changes: 12 additions & 12 deletions rust/src/proofs/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1565,7 +1565,7 @@ pub mod tests {

// write the second
{
let existing = vec![127u64];
let existing = [127u64];

let resp = unsafe {
write_with_alignment(registered_proof, src_fd_b, 508, dst_fd, existing[..].into())
Expand Down Expand Up @@ -1670,7 +1670,7 @@ pub mod tests {
#[test]
#[allow(clippy::cognitive_complexity)]
fn test_sealing_versions() -> Result<()> {
let versions = vec![
let versions = [
RegisteredSealProof::StackedDrg2KiBV1,
RegisteredSealProof::StackedDrg2KiBV1_1,
RegisteredSealProof::StackedDrg2KiBV1_1_Feat_SyntheticPoRep,
Expand Down Expand Up @@ -1745,7 +1745,7 @@ pub mod tests {
panic!("write_without_alignment failed: {:?}", msg);
}

let existing_piece_sizes = vec![127];
let existing_piece_sizes = [127];

let resp_a2 = unsafe {
write_with_alignment(
Expand All @@ -1762,7 +1762,7 @@ pub mod tests {
panic!("write_with_alignment failed: {:?}", msg);
}

let pieces = vec![
let pieces = [
PublicPieceInfo {
num_bytes: 127,
comm_p: resp_a1.comm_p,
Expand Down Expand Up @@ -1987,7 +1987,7 @@ pub mod tests {
panic!("write_without_alignment failed: {:?}", msg);
}

let existing_piece_sizes = vec![127];
let existing_piece_sizes = [127];

let resp_new_a2 = unsafe {
write_with_alignment(
Expand Down Expand Up @@ -2299,7 +2299,7 @@ pub mod tests {

// generate a PoSt

let sectors = vec![sector_id];
let sectors = [sector_id];
let resp_f = generate_winning_post_sector_challenge(
registered_proof_winning_post,
&randomness,
Expand Down Expand Up @@ -2553,7 +2553,7 @@ pub mod tests {
//
//////////////////////////////////////////////

let sectors = vec![sector_id, sector_id2];
let sectors = [sector_id, sector_id2];
let private_replicas = vec![
PrivateReplicaInfo {
registered_proof: registered_proof_window_post,
Expand Down Expand Up @@ -2861,7 +2861,7 @@ pub mod tests {
panic!("write_without_alignment failed: {:?}", msg);
}

let existing_piece_sizes = vec![127];
let existing_piece_sizes = [127];

let resp_a2 = unsafe {
write_with_alignment(
Expand Down Expand Up @@ -3050,7 +3050,7 @@ pub mod tests {
panic!("write_without_alignment failed: {:?}", msg);
}

let existing_piece_sizes = vec![127];
let existing_piece_sizes = [127];

let resp_a2 = unsafe {
write_with_alignment(
Expand Down Expand Up @@ -3189,10 +3189,10 @@ pub mod tests {

assert!(**resp_d2, "proof was not valid");

let seal_commit_responses = vec![resp_c2.value.clone(), resp_c22.value.clone()];
let seal_commit_responses = [resp_c2.value.clone(), resp_c22.value.clone()];

let comm_rs = vec![resp_b2.comm_r, resp_b2.comm_r];
let seeds = vec![seed, seed];
let comm_rs = [resp_b2.comm_r, resp_b2.comm_r];
let seeds = [seed, seed];
let resp_aggregate_proof = aggregate_seal_proofs(
registered_proof_seal,
registered_aggregation,
Expand Down

0 comments on commit e1e2294

Please sign in to comment.