clippy all codes (#1214)

1. clippy code
2. add fmt and clippy check in ci
This commit is contained in:
Sijie.Sun
2025-08-10 22:56:41 +08:00
committed by GitHub
parent 0087ac3ffc
commit e43537939a
144 changed files with 1475 additions and 1531 deletions
+10 -6
View File
@@ -34,7 +34,7 @@ impl From<LimiterConfig> for BucketConfig {
.unwrap_or(Duration::from_millis(10));
BucketConfig {
capacity: burst_rate * fill_rate,
fill_rate: fill_rate,
fill_rate,
refill_interval,
}
}
@@ -162,6 +162,12 @@ pub struct TokenBucketManager {
retain_task: ScopedTask<()>,
}
impl Default for TokenBucketManager {
fn default() -> Self {
Self::new()
}
}
impl TokenBucketManager {
/// Creates a new TokenBucketManager
pub fn new() -> Self {
@@ -318,7 +324,7 @@ mod tests {
// Should have accumulated about 100 tokens (10,000 tokens/s * 0.001s)
let tokens = bucket.available_tokens.load(Ordering::Relaxed);
assert!(
tokens >= 100 && tokens <= 200,
(100..=200).contains(&tokens),
"Unexpected token count: {}",
tokens
);
@@ -355,8 +361,7 @@ mod tests {
.list_foreign_networks()
.await
.foreign_networks
.len()
== 0
.is_empty()
},
Duration::from_secs(5),
)
@@ -370,8 +375,7 @@ mod tests {
.get_global_ctx()
.token_bucket_manager()
.buckets
.len()
== 0
.is_empty()
},
Duration::from_secs(10),
)