Clean up clippy fixes

This commit is contained in:
onyinyang 2023-06-22 17:07:14 -04:00
parent 369d830bca
commit 607466b949
No known key found for this signature in database
GPG Key ID: 156A6435430C2036
3 changed files with 8 additions and 9 deletions

View File

@ -8,7 +8,6 @@ use lox_library::{
}, },
BridgeAuth, BridgeDb, IssuerPubKey, BridgeAuth, BridgeDb, IssuerPubKey,
}; };
use lox_utils;
use std::{sync::{Arc, Mutex}, collections::HashMap}; use std::{sync::{Arc, Mutex}, collections::HashMap};
use zkp::ProofError; use zkp::ProofError;
@ -79,11 +78,13 @@ impl LoxServerContext {
result result
} }
/* Uncomment when bridge blocking is finalized
pub fn add_unreachable(&self, bridgeline: BridgeLine) -> bool { pub fn add_unreachable(&self, bridgeline: BridgeLine) -> bool {
let mut ba_obj = self.ba.lock().unwrap(); let mut ba_obj = self.ba.lock().unwrap();
let mut db_obj = self.db.lock().unwrap(); let mut db_obj = self.db.lock().unwrap();
ba_obj.bridge_unreachable(&bridgeline, &mut db_obj) ba_obj.bridge_unreachable(&bridgeline, &mut db_obj)
} }
*/
pub fn update_bridge(&self, bridgeline: BridgeLine) -> bool { pub fn update_bridge(&self, bridgeline: BridgeLine) -> bool {
let mut ba_obj = self.ba.lock().unwrap(); let mut ba_obj = self.ba.lock().unwrap();

View File

@ -300,8 +300,7 @@ impl BridgeAuth {
bridges: [BridgeLine; MAX_BRIDGES_PER_BUCKET], bridges: [BridgeLine; MAX_BRIDGES_PER_BUCKET],
bdb: &mut BridgeDb, bdb: &mut BridgeDb,
) { ) {
let bnum: u32; let bnum = self.bridge_table.new_bucket(&bridges);
bnum = self.bridge_table.new_bucket(&bridges);
let mut single = [BridgeLine::default(); MAX_BRIDGES_PER_BUCKET]; let mut single = [BridgeLine::default(); MAX_BRIDGES_PER_BUCKET];
for b in bridges.iter() { for b in bridges.iter() {
single[0] = *b; single[0] = *b;
@ -313,8 +312,7 @@ impl BridgeAuth {
/// Insert a hot spare bucket of bridges /// Insert a hot spare bucket of bridges
pub fn add_spare_bucket(&mut self, bucket: [BridgeLine; MAX_BRIDGES_PER_BUCKET]) { pub fn add_spare_bucket(&mut self, bucket: [BridgeLine; MAX_BRIDGES_PER_BUCKET]) {
let bnum: u32; let bnum = self.bridge_table.new_bucket(&bucket);
bnum = self.bridge_table.new_bucket(&bucket);
self.bridge_table.spares.insert(bnum); self.bridge_table.spares.insert(bnum);
} }
@ -468,7 +466,7 @@ impl BridgeAuth {
} }
} }
for (bucketnum, offset) in positions.iter() { for (bucketnum, offset) in positions.iter() {
let mut bridgelines = match self.bridge_table.buckets.get(&bucketnum) { let mut bridgelines = match self.bridge_table.buckets.get(bucketnum) {
Some(bridgelines) => *bridgelines, Some(bridgelines) => *bridgelines,
None => return ReplaceSuccess::NotReplaced, None => return ReplaceSuccess::NotReplaced,
}; };
@ -493,7 +491,7 @@ impl BridgeAuth {
} }
None => return res, None => return res,
}; };
return res; res
} }
/// Mark a bridge as unreachable /// Mark a bridge as unreachable
@ -526,7 +524,7 @@ impl BridgeAuth {
if let Some(v) = positions { if let Some(v) = positions {
for (bucketnum, offset) in v.iter() { for (bucketnum, offset) in v.iter() {
// Count how many bridges in this bucket are reachable // Count how many bridges in this bucket are reachable
let mut bucket = match self.bridge_table.buckets.get(&bucketnum) { let mut bucket = match self.bridge_table.buckets.get(bucketnum) {
Some(bridgelines) => *bridgelines, Some(bridgelines) => *bridgelines,
None => return false, None => return false,
}; };

View File

@ -197,7 +197,7 @@ impl BridgeAuth {
// Create the bucket attribute (Scalar), which is a combination // Create the bucket attribute (Scalar), which is a combination
// of the bucket id (u32) and the bucket's decryption key ([u8; 16]) // of the bucket id (u32) and the bucket's decryption key ([u8; 16])
let bucket_key = self.bridge_table.keys.get(&bucket_id_u32).unwrap(); let bucket_key = self.bridge_table.keys.get(&bucket_id_u32).unwrap();
let bucket: Scalar = bridge_table::to_scalar(bucket_id_u32, &bucket_key); let bucket: Scalar = bridge_table::to_scalar(bucket_id_u32, bucket_key);
let bridge_lines = self.bridge_table.buckets.get(&bucket_id_u32).unwrap(); let bridge_lines = self.bridge_table.buckets.get(&bucket_id_u32).unwrap();
let bridge_line = bridge_lines[0]; let bridge_line = bridge_lines[0];