Apply clippy fixes for code quality
Clippy Fixes Applied:
- Removed unused imports
- Fixed manual implementation of .is_multiple_of()
- Fixed unnecessary_sort_by suggestions
- Added missing Ipv4Addr imports
Files Modified:
- forward_acl.rs: Add Ipv4Addr import
- known_hosts.rs: Add Ipv4Addr import
- Various files: Remove unused imports
Build: ✅ markbase-core
Tests: 495 passed
This commit is contained in:
@@ -6,14 +6,13 @@
|
||||
//!
|
||||
//! MarkBase uses SHA-256 (32 bytes) per 4KB block for integrity verification.
|
||||
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::path::PathBuf;
|
||||
use std::io::{Read, Write, Seek, SeekFrom};
|
||||
use std::io::{Read, Write};
|
||||
|
||||
use sha2::{Sha256, Digest};
|
||||
use serde::{Serialize, Deserialize};
|
||||
|
||||
use super::{VfsBackend, VfsFile, VfsError, VfsStat};
|
||||
use super::{VfsBackend, VfsFile, VfsError};
|
||||
|
||||
pub const BLOCK_SIZE: usize = 4096;
|
||||
pub const HASH_SIZE: usize = 32; // SHA-256
|
||||
@@ -71,7 +70,7 @@ impl VfsChecksumFile {
|
||||
|
||||
pub fn block_count(&self) -> usize {
|
||||
(self.file_size as usize / BLOCK_SIZE) +
|
||||
if self.file_size as usize % BLOCK_SIZE > 0 { 1 } else { 0 }
|
||||
if !(self.file_size as usize).is_multiple_of(BLOCK_SIZE) { 1 } else { 0 }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -214,7 +213,7 @@ pub fn scrub_file(
|
||||
corrupted_blocks.push(offset);
|
||||
|
||||
if repair {
|
||||
if let Ok(_) = repair_block(backend, file_path, offset, &buffer) {
|
||||
if repair_block(backend, file_path, offset, &buffer).is_ok() {
|
||||
repaired_blocks.push(offset);
|
||||
}
|
||||
}
|
||||
@@ -283,10 +282,10 @@ fn scrub_recursive(
|
||||
///
|
||||
/// Tries RAID repair first (if backend is RAID), then Dedup repair.
|
||||
pub fn repair_block(
|
||||
backend: &dyn VfsBackend,
|
||||
file_path: &PathBuf,
|
||||
offset: u64,
|
||||
expected_checksum: &[u8],
|
||||
_backend: &dyn VfsBackend,
|
||||
_file_path: &PathBuf,
|
||||
_offset: u64,
|
||||
_expected_checksum: &[u8],
|
||||
) -> Result<Vec<u8>, VfsError> {
|
||||
// Try Dedup repair first (check if block exists in dedup store)
|
||||
// This requires the backend to have dedup integration
|
||||
|
||||
Reference in New Issue
Block a user