Skip to content

Commit

Permalink
fix: clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
raimundo-henriques committed Sep 17, 2024
1 parent e956015 commit 83811a8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion gen/src/arbitrary_impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ impl Arbitrary for LowerAToZNumDash {
let i = v % 37;

match i {
0 => '-' as u8,
0 => b'-',
1..=10 => i + 47,
_ => i + 86,
}
Expand Down
7 changes: 5 additions & 2 deletions gen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -683,8 +683,6 @@ pub fn gen_rnd_demo_data(size: u8) -> Vec<ProductFootprint> {
loop {
let mut tce = Tce::arbitrary(&mut og);

tce.shipment_id = ship_foot.shipment_id.clone();

if let Some(prev_tce) = tces.last() {
// Updates prevTceIds for the current TCE
prev_tces.push(prev_tce.tce_id.clone());
Expand Down Expand Up @@ -725,6 +723,8 @@ pub fn gen_rnd_demo_data(size: u8) -> Vec<ProductFootprint> {
Some(vec![CharFactors::Ar6]),
);

tce.shipment_id.clone_from(&ship_foot.shipment_id);

hocs.push(hoc);
}

Expand Down Expand Up @@ -753,9 +753,12 @@ pub fn gen_rnd_demo_data(size: u8) -> Vec<ProductFootprint> {
Some(vec![CharFactors::Ar6]),
);

tce.shipment_id.clone_from(&ship_foot.shipment_id);

tocs.push(toc.clone());
}


tces.push(tce);
i += 1;
if i == limit {
Expand Down
12 changes: 6 additions & 6 deletions gen/src/pact_integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,8 @@ fn ship_foot_to_pfc() {
"ShipmentFootprint with id shipment-test"
);
assert_eq!(pfc.pcf.declared_unit, DeclaredUnit::TonKilometer);
assert_eq!(pfc.pcf.unitary_product_amount.0, dec!(33840).into());
assert_eq!(pfc.pcf.p_cf_excluding_biogenic.0, dec!(3131.06).into());
assert_eq!(pfc.pcf.unitary_product_amount.0, dec!(33840));
assert_eq!(pfc.pcf.p_cf_excluding_biogenic.0, dec!(3131.06));
}

#[test]
Expand Down Expand Up @@ -401,8 +401,8 @@ fn toc_to_pcf() {

assert_eq!(pfc.product_name_company.0, "TOC with ID toc-test");
assert_eq!(pfc.pcf.declared_unit, DeclaredUnit::TonKilometer);
assert_eq!(pfc.pcf.unitary_product_amount.0, dec!(1).into());
assert_eq!(pfc.pcf.p_cf_excluding_biogenic.0, dec!(0.007).into());
assert_eq!(pfc.pcf.unitary_product_amount.0, dec!(1));
assert_eq!(pfc.pcf.p_cf_excluding_biogenic.0, dec!(0.007));
}

#[test]
Expand Down Expand Up @@ -452,6 +452,6 @@ fn hoc_to_pfc() {

assert_eq!(pfc.product_name_company.0, "HOC with ID hoc-test");
assert_eq!(pfc.pcf.declared_unit, DeclaredUnit::Kilogram);
assert_eq!(pfc.pcf.unitary_product_amount.0, dec!(1000).into());
assert_eq!(pfc.pcf.p_cf_excluding_biogenic.0, dec!(33).into());
assert_eq!(pfc.pcf.unitary_product_amount.0, dec!(1000));
assert_eq!(pfc.pcf.p_cf_excluding_biogenic.0, dec!(33));
}

0 comments on commit 83811a8

Please sign in to comment.