Fix clippy warnings (#7625)

* Fix clippy check

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Autofix clippy

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Fix trivial

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* fmt

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* suppress warnings

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Quiet clippy 😌

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

---------

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
This commit is contained in:
Oliver Tale-Yazdi
2023-08-16 14:20:31 +02:00
committed by GitHub
parent a0f83eb992
commit d501d92176
51 changed files with 729 additions and 1073 deletions
+4 -4
View File
@@ -793,7 +793,7 @@ mod tests {
if leases.contains_key(&(para, period)) {
return Err(LeaseError::AlreadyLeased)
}
leases.insert((para, period), LeaseData { leaser: leaser.clone(), amount });
leases.insert((para, period), LeaseData { leaser: *leaser, amount });
}
Ok(())
})
@@ -1391,7 +1391,7 @@ mod tests {
(1, 2.into(), 53, SlotRange::TwoTwo),
(5, 3.into(), 1, SlotRange::ThreeThree),
];
assert_eq!(Auctions::calculate_winners(winning.clone()), winners);
assert_eq!(Auctions::calculate_winners(winning), winners);
winning[SlotRange::ZeroOne as u8 as usize] = Some((4, 10.into(), 3));
let winners = vec![
@@ -1399,11 +1399,11 @@ mod tests {
(1, 2.into(), 53, SlotRange::TwoTwo),
(5, 3.into(), 1, SlotRange::ThreeThree),
];
assert_eq!(Auctions::calculate_winners(winning.clone()), winners);
assert_eq!(Auctions::calculate_winners(winning), winners);
winning[SlotRange::ZeroThree as u8 as usize] = Some((1, 100.into(), 100));
let winners = vec![(1, 100.into(), 100, SlotRange::ZeroThree)];
assert_eq!(Auctions::calculate_winners(winning.clone()), winners);
assert_eq!(Auctions::calculate_winners(winning), winners);
}
#[test]
+3 -3
View File
@@ -970,16 +970,16 @@ mod tests {
ENDING_PERIOD.with(|p| *p.borrow_mut() = ending_period);
}
fn auction() -> Option<(u64, u64)> {
AUCTION.with(|p| p.borrow().clone())
AUCTION.with(|p| *p.borrow())
}
fn ending_period() -> u64 {
ENDING_PERIOD.with(|p| p.borrow().clone())
ENDING_PERIOD.with(|p| *p.borrow())
}
fn bids() -> Vec<BidPlaced> {
BIDS_PLACED.with(|p| p.borrow().clone())
}
fn vrf_delay() -> u64 {
VRF_DELAY.with(|p| p.borrow().clone())
VRF_DELAY.with(|p| *p.borrow())
}
fn set_vrf_delay(delay: u64) {
VRF_DELAY.with(|p| *p.borrow_mut() = delay);
+6 -8
View File
@@ -140,26 +140,24 @@ mod tests {
// F * (B + msg_length * M)
// message_length = 1
let result: u128 = TestFeeTracker::get_fee_factor(id.clone()).saturating_mul_int(b + m);
let result: u128 = TestFeeTracker::get_fee_factor(id).saturating_mul_int(b + m);
assert_eq!(
TestExponentialPrice::price_for_parachain_delivery(id.clone(), &Xcm(vec![])),
TestExponentialPrice::price_for_parachain_delivery(id, &Xcm(vec![])),
(FeeAssetId::get(), result).into()
);
// message size = 2
let result: u128 =
TestFeeTracker::get_fee_factor(id.clone()).saturating_mul_int(b + (2 * m));
let result: u128 = TestFeeTracker::get_fee_factor(id).saturating_mul_int(b + (2 * m));
assert_eq!(
TestExponentialPrice::price_for_parachain_delivery(id.clone(), &Xcm(vec![ClearOrigin])),
TestExponentialPrice::price_for_parachain_delivery(id, &Xcm(vec![ClearOrigin])),
(FeeAssetId::get(), result).into()
);
// message size = 4
let result: u128 =
TestFeeTracker::get_fee_factor(id.clone()).saturating_mul_int(b + (4 * m));
let result: u128 = TestFeeTracker::get_fee_factor(id).saturating_mul_int(b + (4 * m));
assert_eq!(
TestExponentialPrice::price_for_parachain_delivery(
id.clone(),
id,
&Xcm(vec![SetAppendix(Xcm(vec![ClearOrigin]))])
),
(FeeAssetId::get(), result).into()