Skip to content

Commit

Permalink
Fix clippy warnings with Rust '1.70.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
jpraynaud committed Jun 5, 2023
1 parent dadb34c commit d987179
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
27 changes: 16 additions & 11 deletions mithril-aggregator/src/database/provider/single_signature.rs
Expand Up @@ -311,15 +311,14 @@ mod tests {
fn test_convert_single_signatures() {
let single_signature = fake_data::single_signatures(vec![1, 3, 4, 6, 7, 9]);
let open_message_id = Uuid::parse_str("193d1442-e89b-43cf-9519-04d8db9a12ff").unwrap();
let single_signature_expected = single_signature.clone();

let single_signature_record = SingleSignatureRecord::from_single_signatures(
&single_signature,
&open_message_id,
Epoch(1),
);
let single_signature = single_signature_record.into();
assert_eq!(single_signature_expected, single_signature);
let single_signature_returned = single_signature_record.into();
assert_eq!(single_signature, single_signature_returned);
}

#[test]
Expand Down Expand Up @@ -411,14 +410,14 @@ mod tests {

#[tokio::test]
async fn test_get_single_signature_records() {
let single_signature_records = setup_single_signature_records(2, 3, 4);
let single_signature_records_src = setup_single_signature_records(2, 3, 4);

let connection = Connection::open(":memory:").unwrap();
setup_single_signature_db(&connection, single_signature_records.clone()).unwrap();
setup_single_signature_db(&connection, single_signature_records_src.clone()).unwrap();

let provider = SingleSignatureRecordProvider::new(&connection);

let open_message_id_test = single_signature_records[0].open_message_id.to_owned();
let open_message_id_test = single_signature_records_src[0].open_message_id.to_owned();
let single_signature_records: Vec<SingleSignatureRecord> = provider
.get_by_open_message_id(&open_message_id_test)
.unwrap()
Expand Down Expand Up @@ -467,11 +466,17 @@ mod tests {
.collect();
assert!(single_signature_records.is_empty());

let single_signature_records: Vec<SingleSignatureRecord> =
provider.get_all().unwrap().collect();
let expected_single_signature_records: Vec<SingleSignatureRecord> =
single_signature_records.clone();
assert_eq!(expected_single_signature_records, single_signature_records);
let single_signature_records_returned: Vec<SingleSignatureRecord> = provider
.get_all()
.unwrap()
.collect::<Vec<_>>()
.into_iter()
.rev()
.collect();
assert_eq!(
single_signature_records_src,
single_signature_records_returned
);
}

#[test]
Expand Down
1 change: 1 addition & 0 deletions mithril-stm/src/eligibility_check.rs
Expand Up @@ -61,6 +61,7 @@ pub(crate) fn ev_lt_phi(phi_f: f64, ev: [u8; 64], stake: Stake, total_stake: Sta
/// Therefore, a good integral bound is the maximum value that `|ln(1.0 - phi_f)|` can take with
/// `phi_f \in [0, 0.95]` (if we expect to have `phi_f > 0.95` this bound should be extended),
/// which is `3`. Hence, we set `M = 3`.
#[allow(clippy::redundant_clone)]
fn taylor_comparison(bound: usize, cmp: Ratio<BigInt>, x: Ratio<BigInt>) -> bool {
let mut new_x = x.clone();
let mut phi: Ratio<BigInt> = One::one();
Expand Down

0 comments on commit d987179

Please sign in to comment.