[router] add cargo clippy in CI and fix-up linting errors (#9242)

This commit is contained in:
Jeff Nettleton
2025-08-17 11:03:56 -07:00
committed by GitHub
parent 4d98e48649
commit ce3ca9b02f
17 changed files with 111 additions and 191 deletions

View File

@@ -137,8 +137,7 @@ mod tests {
fn test_worker_result_type_alias() {
// Test Ok variant
let result: WorkerResult<i32> = Ok(42);
assert!(result.is_ok());
assert_eq!(result.unwrap(), 42);
assert!(matches!(result, Ok(42)));
// Test Err variant
let error = WorkerError::WorkerNotFound {

View File

@@ -311,13 +311,7 @@ impl Worker for BasicWorker {
// Use the shared client with a custom timeout for this request
let health_result = match WORKER_CLIENT.get(&health_url).timeout(timeout).send().await {
Ok(response) => {
if response.status().is_success() {
true
} else {
false
}
}
Ok(response) => response.status().is_success(),
Err(_) => false,
};
@@ -571,6 +565,7 @@ impl WorkerFactory {
}
/// Create workers from URLs with automatic type detection
#[allow(clippy::type_complexity)]
pub fn create_from_urls(
regular_urls: Vec<String>,
prefill_urls: Vec<(String, Option<u16>)>,
@@ -1202,12 +1197,6 @@ mod tests {
for handle in handles {
handle.await.unwrap();
}
// Final state should be deterministic (last write wins)
// We can't predict the exact final state due to scheduling,
// but we can verify no data corruption occurred
let final_health = worker.is_healthy();
assert!(final_health == true || final_health == false);
}
// Test WorkerFactory