Skip to content

Commit

Permalink
Fixing clippy and format issues.
Browse files Browse the repository at this point in the history
Signed-off-by: Andres Santana <[email protected]>
  • Loading branch information
arsh committed Mar 10, 2024
1 parent 38ce78d commit 710bc03
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions mountpoint-s3/benches/cache_serialization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ fn write_file(data: &Vec<u8>) {
file.write_all(data.as_slice()).expect("is able to write file");
}

fn write_cache_bincode(data: &Vec<u8>) {
fn write_cache_bincode(data: &[u8]) {
let config = DiskDataCacheConfig {
block_size: BLOCK_SIZE,
limit: mountpoint_s3::data_cache::CacheLimit::Unbounded,
Expand All @@ -71,13 +71,13 @@ fn write_cache_bincode(data: &Vec<u8>) {
let cache_dir = PathBuf::from("/tmp/mp-cache1/");
let cache = DiskDataCache::new(cache_dir, config);
let cache_key = ObjectId::new("a".into(), ETag::for_tests());
let data = ChecksummedBytes::new(data.clone().into());
let data = ChecksummedBytes::new(data.to_owned().into());
cache
.put_block(cache_key.clone(), 0, 0, data)
.expect("is able to write to cache");
}

fn write_cache_bincode2(data: &Vec<u8>) {
fn write_cache_bincode2(data: &[u8]) {
let config = DiskDataCacheConfig {
block_size: BLOCK_SIZE,
limit: mountpoint_s3::data_cache::CacheLimit::Unbounded,
Expand All @@ -88,7 +88,7 @@ fn write_cache_bincode2(data: &Vec<u8>) {
let cache_dir = PathBuf::from("/tmp/mp-cache2/");
let cache = DiskDataCache::new(cache_dir, config);
let cache_key = ObjectId::new("a".into(), ETag::for_tests());
let data = ChecksummedBytes::new(data.clone().into());
let data = ChecksummedBytes::new(data.to_owned().into());
cache
.put_block(cache_key.clone(), 0, 0, data)
.expect("is able to write to cache");
Expand All @@ -110,9 +110,9 @@ fn setup() {
pub fn criterion_benchmark(c: &mut Criterion) {
setup();

c.bench_function("read_cache_bincode", |b| b.iter(|| read_cache_bincode()));
c.bench_function("read_cache_bincode2", |b| b.iter(|| read_cache_bincode2()));
c.bench_function("read_file", |b| b.iter(|| read_file()));
c.bench_function("read_cache_bincode", |b| b.iter(read_cache_bincode));
c.bench_function("read_cache_bincode2", |b| b.iter(read_cache_bincode2));
c.bench_function("read_file", |b| b.iter(read_file));

cleanup();
}
Expand Down
2 changes: 1 addition & 1 deletion mountpoint-s3/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ where
filesystem_config,
fuse_config,
&bucket_description,
)?;
)?;

fuse_session.run_on_close(Box::new(move || {
drop(managed_cache_dir);
Expand Down
2 changes: 1 addition & 1 deletion mountpoint-s3/src/data_cache/disk_data_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ impl DiskDataCache {
.open(path.as_ref())?;
file.write_all(CACHE_VERSION.as_bytes())?;
let writer = &self.config.writer;
writer.write_to_file(&mut file, &block)
writer.write_to_file(&file, &block)
}

fn is_limit_exceeded(&self, size: usize) -> bool {
Expand Down

0 comments on commit 710bc03

Please sign in to comment.