mirror of
https://github.com/deuxfleurs-org/garage.git
synced 2026-08-13 07:46:51 +00:00
chore: clean relative to references and borrows
- lint message: the borrowed expression implements the required traits help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#needless_borrows_for_generic_args - lint message: this expression creates a reference which is immediately dereferenced by the compiler help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#needless_borrow - lint message: you don't need to add `&` to all patterns help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#match_ref_pat - remove useless taken reference lint message: needlessly taken reference of left operand help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#op_ref - use &Path instead of &PathBuf as fn parameters lint message: writing `&PathBuf` instead of `&Path` involves a new object where a slice will do help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#ptr_arg
This commit is contained in:
@@ -95,7 +95,7 @@ impl<'a> BucketHelper<'a> {
|
||||
if let Some(Some(bucket_id)) = api_key_params.local_aliases.get(bucket_name) {
|
||||
self.0
|
||||
.bucket_table
|
||||
.get_local(&EmptyKey, &bucket_id)?
|
||||
.get_local(&EmptyKey, bucket_id)?
|
||||
.filter(|x| !x.state.is_deleted())
|
||||
} else {
|
||||
self.resolve_global_bucket_fast(bucket_name)?
|
||||
@@ -157,7 +157,7 @@ impl<'a> BucketHelper<'a> {
|
||||
let local_alias = self
|
||||
.0
|
||||
.key_table
|
||||
.get(&EmptyKey, &key_id)
|
||||
.get(&EmptyKey, key_id)
|
||||
.await?
|
||||
.and_then(|k| k.state.into_option())
|
||||
.ok_or_else(|| GarageError::Message(format!("access key {} has been deleted", key_id)))?
|
||||
|
||||
@@ -159,7 +159,7 @@ impl Key {
|
||||
return Err("The specified key ID is not a valid Garage key ID (starts with `GK`, followed by 12 hex-encoded bytes)");
|
||||
}
|
||||
|
||||
if secret_key.len() != 64 || hex::decode(&secret_key).is_err() {
|
||||
if secret_key.len() != 64 || hex::decode(secret_key).is_err() {
|
||||
return Err("The specified secret key is not a valid Garage secret key (composed of 32 hex-encoded bytes)");
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use std::fs;
|
||||
use std::path::PathBuf;
|
||||
use std::path::Path;
|
||||
use std::sync::Arc;
|
||||
use std::sync::Mutex;
|
||||
use std::time::{Duration, Instant};
|
||||
@@ -67,9 +67,9 @@ pub fn snapshot_metadata(garage: &Garage) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn cleanup_snapshots(snapshots_dir: &PathBuf) -> Result<(), Error> {
|
||||
fn cleanup_snapshots(snapshots_dir: &Path) -> Result<(), Error> {
|
||||
let mut snapshots =
|
||||
fs::read_dir(&snapshots_dir)?.collect::<Result<Vec<fs::DirEntry>, std::io::Error>>()?;
|
||||
fs::read_dir(snapshots_dir)?.collect::<Result<Vec<fs::DirEntry>, std::io::Error>>()?;
|
||||
|
||||
snapshots.retain(|x| x.file_name().len() > 8);
|
||||
snapshots.sort_by_key(|x| x.file_name());
|
||||
|
||||
Reference in New Issue
Block a user