diff options
| author | necrashter | 2022-04-23 23:02:13 +0300 |
|---|---|---|
| committer | Yigit Sever | 2022-04-23 23:12:09 +0300 |
| commit | 0a190cdde68f533086e029337fde07b74cd7147d (patch) | |
| tree | db70bdc5aa8a1bd5a5f99500aa84f2e36ac25d26 | |
| parent | 8f37c8e2fb2914bd11f35ac2c57a22393eab894f (diff) | |
| download | gradecoin-0a190cdde68f533086e029337fde07b74cd7147d.tar.gz gradecoin-0a190cdde68f533086e029337fde07b74cd7147d.tar.bz2 gradecoin-0a190cdde68f533086e029337fde07b74cd7147d.zip | |
Comply with Rustfmt
| -rw-r--r-- | src/config.rs | 2 | ||||
| -rw-r--r-- | src/db.rs | 18 |
2 files changed, 11 insertions, 9 deletions
diff --git a/src/config.rs b/src/config.rs index 0584c31..297e587 100644 --- a/src/config.rs +++ b/src/config.rs | |||
| @@ -6,7 +6,6 @@ use log::{error, info}; | |||
| 6 | use serde::{Deserialize, Serialize}; | 6 | use serde::{Deserialize, Serialize}; |
| 7 | use std::collections::HashMap; | 7 | use std::collections::HashMap; |
| 8 | 8 | ||
| 9 | |||
| 10 | /// Configuration struct for a single bot | 9 | /// Configuration struct for a single bot |
| 11 | #[derive(Debug, Serialize, Deserialize, Clone, Default)] | 10 | #[derive(Debug, Serialize, Deserialize, Clone, Default)] |
| 12 | pub struct BotConfig { | 11 | pub struct BotConfig { |
| @@ -14,7 +13,6 @@ pub struct BotConfig { | |||
| 14 | pub starting_balance: u16, | 13 | pub starting_balance: u16, |
| 15 | } | 14 | } |
| 16 | 15 | ||
| 17 | |||
| 18 | /// Configuration for a single network | 16 | /// Configuration for a single network |
| 19 | #[derive(Debug, Serialize, Deserialize, Clone, Default)] | 17 | #[derive(Debug, Serialize, Deserialize, Clone, Default)] |
| 20 | pub struct Config { | 18 | pub struct Config { |
| @@ -142,15 +142,19 @@ fn read_users(config_name: &str) -> io::Result<Vec<PathBuf>> { | |||
| 142 | fn get_bots(bot_configs: &HashMap<Fingerprint, BotConfig>) -> HashMap<Fingerprint, User> { | 142 | fn get_bots(bot_configs: &HashMap<Fingerprint, BotConfig>) -> HashMap<Fingerprint, User> { |
| 143 | let mut index = 0; | 143 | let mut index = 0; |
| 144 | 144 | ||
| 145 | bot_configs.iter() | 145 | bot_configs |
| 146 | .iter() | ||
| 146 | .map(|(fingerprint, config)| { | 147 | .map(|(fingerprint, config)| { |
| 147 | index += 1; | 148 | index += 1; |
| 148 | (fingerprint.to_string(), User { | 149 | ( |
| 149 | user_id: MetuId::new(format!("friend_{}", index), "not_used".to_owned()), | 150 | fingerprint.to_string(), |
| 150 | public_key: "not_used".to_owned(), | 151 | User { |
| 151 | balance: config.starting_balance, | 152 | user_id: MetuId::new(format!("friend_{}", index), "not_used".to_owned()), |
| 152 | is_bot: true, | 153 | public_key: "not_used".to_owned(), |
| 153 | }) | 154 | balance: config.starting_balance, |
| 155 | is_bot: true, | ||
| 156 | }, | ||
| 157 | ) | ||
| 154 | }) | 158 | }) |
| 155 | .collect() | 159 | .collect() |
| 156 | } | 160 | } |
