fix: resolve all Clippy warnings across codebase - Fixed field reassignment warnings in ecstore/src/file_meta.rs by using struct initialization instead of default + field assignment - Fixed overly complex boolean expression in ecstore/src/utils/os/mod.rs by removing meaningless assertion - Replaced manual Default implementation with derive in crates/zip/src/lib.rs - Updated io::Error usage to use io::Error::other() instead of deprecated pattern - Removed useless assertions and clone-on-copy warnings - Fixed unwrap usage by replacing with expect() providing meaningful error messages - Fixed useless vec usage by using array repeat instead - All code now passes comprehensive Clippy check with --all-targets --all-features -- -D warnings

This commit is contained in:
安正超
2025-05-28 11:00:07 +08:00
parent 96d0155bcc
commit a1f4abf6c3
37 changed files with 309 additions and 255 deletions
+4 -2
View File
@@ -279,8 +279,10 @@ mod tests {
let result: Result<(), Error> = Err(error);
assert!(result.is_err());
let err = result.unwrap_err();
assert!(err.is::<io::Error>());
// Test the error from the result
if let Err(err) = result {
assert!(err.is::<io::Error>());
}
}
#[test]
+21 -11
View File
@@ -245,8 +245,10 @@ mod tests {
#[test]
fn test_last_minute_latency_clone() {
let mut latency = LastMinuteLatency::default();
latency.last_sec = 12345;
let mut latency = LastMinuteLatency {
last_sec: 12345,
..Default::default()
};
latency.totals[0].total = 100;
let cloned = latency.clone();
@@ -257,8 +259,10 @@ mod tests {
#[test]
fn test_forward_to_same_time() {
let mut latency = LastMinuteLatency::default();
latency.last_sec = 100;
let mut latency = LastMinuteLatency {
last_sec: 100,
..Default::default()
};
// Forward to same time should not change anything
latency.forward_to(100);
@@ -271,8 +275,10 @@ mod tests {
#[test]
fn test_forward_to_large_gap() {
let mut latency = LastMinuteLatency::default();
latency.last_sec = 100;
let mut latency = LastMinuteLatency {
last_sec: 100,
..Default::default()
};
latency.totals[0].total = 999; // Set some data
// Forward by more than 60 seconds should reset all totals
@@ -289,8 +295,10 @@ mod tests {
#[test]
fn test_forward_to_small_gap() {
let mut latency = LastMinuteLatency::default();
latency.last_sec = 100;
let mut latency = LastMinuteLatency {
last_sec: 100,
..Default::default()
};
latency.totals[1].total = 999; // Set some data at index 1
// Forward by 2 seconds
@@ -446,7 +454,7 @@ mod tests {
#[test]
fn test_window_index_calculation() {
// Test that window index calculation works correctly
let mut latency = LastMinuteLatency::default();
let _latency = LastMinuteLatency::default();
let acc_elem = AccElem {
total: 1,
@@ -476,10 +484,12 @@ mod tests {
#[test]
fn test_edge_case_boundary_conditions() {
let mut latency = LastMinuteLatency::default();
let mut latency = LastMinuteLatency {
last_sec: 59,
..Default::default()
};
// Test boundary at 60 seconds
latency.last_sec = 59;
latency.forward_to(119); // Exactly 60 seconds later
// Should reset all totals