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

View File

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

View File

@ -197,7 +197,7 @@ impl BridgeAuth {
// Create the bucket attribute (Scalar), which is a combination
// 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: 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_line = bridge_lines[0];