From bbbcd3b4877c03c432684fb386f96461f0b70d91 Mon Sep 17 00:00:00 2001
From: librelois <c@elo.tf>
Date: Thu, 13 Jan 2022 00:01:11 +0100
Subject: [PATCH] rustfmt

---
 integration-tests/tests/common/balances.rs | 12 ++--
 integration-tests/tests/cucumber_tests.rs  | 71 ++++++++++++++--------
 2 files changed, 50 insertions(+), 33 deletions(-)

diff --git a/integration-tests/tests/common/balances.rs b/integration-tests/tests/common/balances.rs
index 5ed57f800..3de606739 100644
--- a/integration-tests/tests/common/balances.rs
+++ b/integration-tests/tests/common/balances.rs
@@ -14,11 +14,11 @@
 // You should have received a copy of the GNU Affero General Public License
 // along with Substrate-Libre-Currency. If not, see <https://www.gnu.org/licenses/>.
 
-use super::*;
 use super::node_runtime::runtime_types::gdev_runtime;
 use super::node_runtime::runtime_types::pallet_balances;
+use super::*;
 use sp_keyring::AccountKeyring;
-use subxt::{sp_runtime::MultiAddress,PairSigner};
+use subxt::{sp_runtime::MultiAddress, PairSigner};
 
 pub async fn set_balance(
     api: &Api,
@@ -26,10 +26,9 @@ pub async fn set_balance(
     who: AccountKeyring,
     amount: u64,
 ) -> Result<()> {
-	let _events = create_block_with_extrinsic(
+    let _events = create_block_with_extrinsic(
         &client,
-        api
-            .tx()
+        api.tx()
             .sudo()
             .sudo(gdev_runtime::Call::Balances(
                 pallet_balances::pallet::Call::set_balance {
@@ -80,8 +79,7 @@ pub async fn transfer_all(
 
     let _events = create_block_with_extrinsic(
         &client,
-        api
-            .tx()
+        api.tx()
             .balances()
             .transfer_all(to.clone().into(), false)
             .create_signed(&from, ())
diff --git a/integration-tests/tests/cucumber_tests.rs b/integration-tests/tests/cucumber_tests.rs
index 03e71c0d7..d1ee4118e 100644
--- a/integration-tests/tests/cucumber_tests.rs
+++ b/integration-tests/tests/cucumber_tests.rs
@@ -52,45 +52,55 @@ impl World for DuniterWorld {
 }
 
 fn parse_amount(amount: u64, unit: &str) -> (u64, bool) {
-	match unit {
-		"ÄžD" => (amount * 100, false),
-		"cÄžD" => (amount, false),
-		"UD" => (amount * 1_000, true),
-		"mUD" => (amount, true),
-		_ => unreachable!(),
-	}
+    match unit {
+        "ÄžD" => (amount * 100, false),
+        "cÄžD" => (amount, false),
+        "UD" => (amount * 1_000, true),
+        "mUD" => (amount, true),
+        _ => unreachable!(),
+    }
 }
 
 #[given(regex = r"([a-zA-Z]+) have (\d+) (ÄžD|cÄžD|UD|mUD)")]
 async fn who_have(world: &mut DuniterWorld, who: String, amount: u64, unit: String) -> Result<()> {
     // Parse inputs
-    let who = AccountKeyring::from_str(&who)
-        .expect("unknown to");
-	let (mut amount, is_ud) = parse_amount(amount, &unit);
-
-	if is_ud {
-		let current_ud_amount = world.api.storage().universal_dividend().current_ud_storage(None).await?;
-		amount = (amount * current_ud_amount) / 1_000;
-	}
+    let who = AccountKeyring::from_str(&who).expect("unknown to");
+    let (mut amount, is_ud) = parse_amount(amount, &unit);
+
+    if is_ud {
+        let current_ud_amount = world
+            .api
+            .storage()
+            .universal_dividend()
+            .current_ud_storage(None)
+            .await?;
+        amount = (amount * current_ud_amount) / 1_000;
+    }
 
     // Create {amount} ÄžD for {who}
-	common::balances::set_balance(&world.api, &world.client, who, amount).await?;
+    common::balances::set_balance(&world.api, &world.client, who, amount).await?;
 
     Ok(())
 }
 
 #[when(regex = r"([a-zA-Z]+) send (\d+) (ÄžD|cÄžD|UD|mUD) to ([a-zA-Z]+)")]
-async fn transfer(world: &mut DuniterWorld, from: String, amount: u64, unit: String, to: String) -> Result<()> {
+async fn transfer(
+    world: &mut DuniterWorld,
+    from: String,
+    amount: u64,
+    unit: String,
+    to: String,
+) -> Result<()> {
     // Parse inputs
     let from = AccountKeyring::from_str(&from).expect("unknown from");
     let to = AccountKeyring::from_str(&to).expect("unknown to");
-	let (amount, is_ud) = parse_amount(amount, &unit);
+    let (amount, is_ud) = parse_amount(amount, &unit);
 
-	if is_ud {
-		common::balances::transfer_ud(&world.api, &world.client, from, amount, to).await
-	} else {
-		common::balances::transfer(&world.api, &world.client, from, amount, to).await
-	}
+    if is_ud {
+        common::balances::transfer_ud(&world.api, &world.client, from, amount, to).await
+    } else {
+        common::balances::transfer(&world.api, &world.client, from, amount, to).await
+    }
 }
 
 #[when(regex = r"([a-zA-Z]+) sends all (?:his|her) (?:ÄžDs?|DUs?) to ([a-zA-Z]+)")]
@@ -99,7 +109,7 @@ async fn send_all_to(world: &mut DuniterWorld, from: String, to: String) -> Resu
     let from = AccountKeyring::from_str(&from).expect("unknown from");
     let to = AccountKeyring::from_str(&to).expect("unknown to");
 
-	common::balances::transfer_all(&world.api, &world.client, from, to).await
+    common::balances::transfer_all(&world.api, &world.client, from, to).await
 }
 
 #[then(regex = r"([a-zA-Z]+) should have (\d+) ÄžD")]
@@ -116,11 +126,20 @@ async fn should_have(world: &mut DuniterWorld, who: String, amount: u64) -> Resu
 }
 
 #[then(regex = r"current UD amount should be (\d+).(\d+)")]
-async fn current_ud_amount_should_be(world: &mut DuniterWorld, amount: u64, cents: u64) -> Result<()> {
+async fn current_ud_amount_should_be(
+    world: &mut DuniterWorld,
+    amount: u64,
+    cents: u64,
+) -> Result<()> {
     // Parse inputs
     let expected_amount = amount + (cents * 100);
 
-    let current_ud_amount = world.api.storage().universal_dividend().current_ud_storage(None).await?;
+    let current_ud_amount = world
+        .api
+        .storage()
+        .universal_dividend()
+        .current_ud_storage(None)
+        .await?;
     assert_eq!(current_ud_amount, expected_amount);
     Ok(())
 }
-- 
GitLab