Formatting changes from cargo fmt

This commit is contained in:
onyinyang 2024-03-12 11:36:32 -04:00
parent 82e63284ce
commit 5f34f49d17
No known key found for this signature in database
GPG Key ID: 156A6435430C2036
3 changed files with 26 additions and 20 deletions

View File

@ -188,7 +188,7 @@ mod tests {
"123.456.789.100".to_owned(), "123.456.789.100".to_owned(),
3002, 3002,
"BE84A97D02130470A1C77839954392BA979F7EE1".to_owned(), "BE84A97D02130470A1C77839954392BA979F7EE1".to_owned(),
ACCEPTED_HOURS_OF_FAILURE-1, ACCEPTED_HOURS_OF_FAILURE - 1,
); );
let resource_two = make_resource( let resource_two = make_resource(
"https".to_owned(), "https".to_owned(),
@ -202,7 +202,7 @@ mod tests {
"123.222.333.444".to_owned(), "123.222.333.444".to_owned(),
6002, 6002,
"C56B9EF202130470A1C77839954392BA979F7FF9".to_owned(), "C56B9EF202130470A1C77839954392BA979F7FF9".to_owned(),
ACCEPTED_HOURS_OF_FAILURE+2, ACCEPTED_HOURS_OF_FAILURE + 2,
); );
let resource_three = make_resource( let resource_three = make_resource(
"scramblesuit".to_owned(), "scramblesuit".to_owned(),
@ -216,7 +216,7 @@ mod tests {
"443.288.222.100".to_owned(), "443.288.222.100".to_owned(),
3042, 3042,
"5E3A8BD902130470A1C77839954392BA979F7B46".to_owned(), "5E3A8BD902130470A1C77839954392BA979F7B46".to_owned(),
ACCEPTED_HOURS_OF_FAILURE+1, ACCEPTED_HOURS_OF_FAILURE + 1,
); );
let resource_four = make_resource( let resource_four = make_resource(
"https".to_owned(), "https".to_owned(),

View File

@ -1065,7 +1065,10 @@ fn test_bridge_replace() {
// Case zero: bridge to be replaced is not in the bridgetable // Case zero: bridge to be replaced is not in the bridgetable
let random_bridgeline = BridgeLine::random(); let random_bridgeline = BridgeLine::random();
assert!( assert!(
!th.ba.bridge_table.reachable.contains_key(&random_bridgeline), !th.ba
.bridge_table
.reachable
.contains_key(&random_bridgeline),
"Random bridgeline happens to be in the bridge_table (and should not be)" "Random bridgeline happens to be in the bridge_table (and should not be)"
); );
assert!( assert!(

View File

@ -831,29 +831,32 @@ pub fn get_next_unlock(constants_str: String, lox_cred_str: String) -> Result<St
days_to_next_level + constants.level_interval[trust_level as usize + 1]; days_to_next_level + constants.level_interval[trust_level as usize + 1];
invitations_at_next_level = constants.level_invitations[trust_level as usize + 1]; invitations_at_next_level = constants.level_invitations[trust_level as usize + 1];
} }
let days_to_blockage_migration_unlock = let days_to_blockage_migration_unlock = match trust_level
match trust_level < constants.min_blockage_migration_trust_level { < constants.min_blockage_migration_trust_level
// If the credential is greater than the minimum level that enables {
// migrating after a blockage, the time to unlock is 0, otherwise we // If the credential is greater than the minimum level that enables
// add the time to upgrade until that level // migrating after a blockage, the time to unlock is 0, otherwise we
true => { // add the time to upgrade until that level
let mut blockage_days = days_to_next_level; true => {
let mut count = 1; let mut blockage_days = days_to_next_level;
while trust_level + count < constants.min_blockage_migration_trust_level { let mut count = 1;
blockage_days += constants.level_interval[trust_level as usize + count as usize]; while trust_level + count < constants.min_blockage_migration_trust_level {
count += 1; blockage_days += constants.level_interval[trust_level as usize + count as usize];
} count += 1;
blockage_days
} }
false => 0, blockage_days
}; }
false => 0,
};
let day_of_level_unlock = let day_of_level_unlock =
(scalar_u32(&lox_cred.lox_credential.level_since).unwrap() + days_to_next_level) as i32; (scalar_u32(&lox_cred.lox_credential.level_since).unwrap() + days_to_next_level) as i32;
let level_unlock_date = JulianDay::new(day_of_level_unlock).to_date(); let level_unlock_date = JulianDay::new(day_of_level_unlock).to_date();
let day_of_invite_unlock = let day_of_invite_unlock =
(scalar_u32(&lox_cred.lox_credential.level_since).unwrap() + days_to_invite_inc) as i32; (scalar_u32(&lox_cred.lox_credential.level_since).unwrap() + days_to_invite_inc) as i32;
let invite_unlock_date = JulianDay::new(day_of_invite_unlock).to_date(); let invite_unlock_date = JulianDay::new(day_of_invite_unlock).to_date();
let day_of_blockage_migration_unlock = (scalar_u32(&lox_cred.lox_credential.level_since).unwrap() + days_to_blockage_migration_unlock) as i32; let day_of_blockage_migration_unlock = (scalar_u32(&lox_cred.lox_credential.level_since)
.unwrap()
+ days_to_blockage_migration_unlock) as i32;
let blockage_migration_unlock_date = let blockage_migration_unlock_date =
JulianDay::new(day_of_blockage_migration_unlock as i32).to_date(); JulianDay::new(day_of_blockage_migration_unlock as i32).to_date();
let next_unlock: lox_utils::LoxNextUnlock = lox_utils::LoxNextUnlock { let next_unlock: lox_utils::LoxNextUnlock = lox_utils::LoxNextUnlock {