Skip to content

Commit 17258ef

Browse files
committed
fix: clippy
1 parent 2ccf8d1 commit 17258ef

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

crates/node/core/src/utils.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ pub fn get_available_disk_space_mb(path: &Path) -> Option<u64> {
105105
let disks = Disks::new_with_refreshed_list();
106106

107107
// Find the disk that contains the given path
108-
for disk in disks.iter() {
108+
for disk in &disks {
109109
let mount_point = disk.mount_point();
110110
if path_canonical.starts_with(mount_point) {
111111
// Get available space in bytes, convert to MB
@@ -168,19 +168,17 @@ mod tests {
168168
// We can't easily mock sysinfo, so we just test that it doesn't panic
169169
// and returns a boolean value
170170
let temp_dir = std::env::temp_dir();
171-
let result = is_disk_space_low(&temp_dir, 1_000_000_000); // Very large threshold
172-
// Should return either true or false, but not panic
173-
assert!(result == true || result == false);
171+
// Should return either true or false, but not panic
172+
let _result = is_disk_space_low(&temp_dir, 1_000_000_000); // Very large threshold
174173
}
175174

176175
#[test]
177176
fn test_is_disk_space_low_with_invalid_path() {
178177
// Test with a non-existent path
179178
let invalid_path = Path::new("/nonexistent/path/that/does/not/exist");
180179
// Should not panic, but may return false (feature disabled) or handle gracefully
181-
let result = is_disk_space_low(invalid_path, 1000);
182-
// Should not panic, result depends on sysinfo behavior
183-
assert!(result == true || result == false);
180+
// Result depends on sysinfo behavior
181+
let _result = is_disk_space_low(invalid_path, 1000);
184182
}
185183

186184
#[test]
@@ -190,9 +188,9 @@ mod tests {
190188
let result = get_available_disk_space_mb(&temp_dir);
191189
// Should return Some(u64) if successful, or None if it fails
192190
match result {
193-
Some(mb) => {
191+
Some(_mb) => {
194192
// If successful, should be a reasonable value (not 0 for temp dir)
195-
assert!(mb > 0 || mb == 0, "Available space should be a valid number");
193+
// Value is already validated as u64, so no need to check bounds
196194
}
197195
None => {
198196
// It's okay if it fails, sysinfo might not work in all test environments

0 commit comments

Comments
 (0)