style: apply rustfmt across bench and core crates
CI / ci (ubuntu-latest) (push) Has been cancelled
CI / ci (windows-latest) (push) Has been cancelled
CI / ci (ubuntu-latest) (push) Has been cancelled
CI / ci (windows-latest) (push) Has been cancelled
Pure formatting pass - no semantic changes. Mostly long-line reflow,
import statement reordering (alphabetical), and trailing-newline fixes
that had been accumulating in the working tree.
Affected files:
* crates/bench/src/{data_gen,main,mmap_reader,pread_reader,report,runner}.rs
* crates/bench/src/suites/{concurrent,growth,jump,memory,render,rotation,startup}.rs
* crates/core/src/io/{file_reader,index_cache,read_cache}.rs
* crates/core/src/{types.rs, watcher/file_watcher.rs}
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
use std::io::{Read as _, Write as _};
|
||||
use std::path::Path;
|
||||
|
||||
use crate::io::cache_util::{cache_path, CACHE_VERSION};
|
||||
use crate::io::cache_util::{CACHE_VERSION, cache_path};
|
||||
use crate::io::line_index::LineIndex;
|
||||
|
||||
pub struct IndexCache;
|
||||
@@ -47,11 +47,7 @@ impl IndexCache {
|
||||
///
|
||||
/// The file hash is derived from `data` (the same byte slice used to build the index),
|
||||
/// avoiding TOCTOU issues from re-reading the file from disk.
|
||||
pub fn save_with_hash(
|
||||
file_path: &Path,
|
||||
index: &LineIndex,
|
||||
data: &[u8],
|
||||
) -> std::io::Result<()> {
|
||||
pub fn save_with_hash(file_path: &Path, index: &LineIndex, data: &[u8]) -> std::io::Result<()> {
|
||||
let dest = cache_path(file_path).ok_or_else(|| {
|
||||
std::io::Error::new(std::io::ErrorKind::NotFound, "cannot determine cache path")
|
||||
})?;
|
||||
@@ -382,6 +378,10 @@ mod tests {
|
||||
}
|
||||
|
||||
let final_data = std::fs::read(&dest).expect("dest file should exist");
|
||||
assert_eq!(final_data.len(), 64 * 1024, "final file must be exactly one payload");
|
||||
assert_eq!(
|
||||
final_data.len(),
|
||||
64 * 1024,
|
||||
"final file must be exactly one payload"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user