mirror of
https://github.com/deuxfleurs-org/garage.git
synced 2026-08-29 08:27:07 +00:00
chore: remove various useless code
- call expect directly on Result lint message: called `ok().expect()` on a `Result` value help: you can call `expect()` directly on the `Result` help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#ok_expect - use assign operation instead of manual implementation lint message: manual implementation of an assign operation help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#assign_op_pattern - remove useless call to format lint message: useless use of `format!` help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#useless_format - remove useless `?Sized` lint message: `?Sized` bound is ignored because of a `Sized` requirement note: ...because `Deserialize` has the bound `Sized` help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#needless_maybe_sized - use is_some instead of pattern maching with Some(_) lint message: redundant pattern matching, consider using `is_some()` help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#redundant_pattern_matching - remove unneeded unit return type lint message: unneeded unit return type help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#unused_unit - remove redundant closure lint message: redundant closure help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#redundant_closure - use derive Default instead of manual implementation lint message: this `impl` can be derived help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#derivable_impls - remove unneeded `return` statement help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#needless_return - remove empty string from println call lint message: empty string literal in `println!` help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#println_empty_string - remove clone() on type than implement Copy lint message: using `clone` on type `Option<ChecksumValue>` which implements the `Copy` trait help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#clone_on_copy - remove useless let binding lint message: this let-binding has unit value help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#let_unit_value - remove useless len comparison to zero, already test of empty lint message: length comparison to zero help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#len_zero - remove useless `as_deref` call lint message: derefed type is same as origin help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#needless_option_as_deref - remove useless conversion of the same type lint message: useless conversion to the same type: `replication_mode::ReplicationFactor` help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#useless_conversion - remove useless bool_comparison lint message: equality checks against false can be replaced by a negation help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#bool_comparison - remove useless to_string lint message: unnecessary use of `to_string` help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#unnecessary_to_owned Signed-off-by: Gwen Lg <me@gwenlg.fr>
This commit is contained in:
+1
-1
@@ -89,7 +89,7 @@ impl DataBlock {
|
||||
return DataBlock::compressed(data_compressed.into());
|
||||
}
|
||||
}
|
||||
DataBlock::plain(data.into())
|
||||
DataBlock::plain(data)
|
||||
})
|
||||
.await
|
||||
.unwrap()
|
||||
|
||||
+2
-2
@@ -325,7 +325,7 @@ fn make_data_dirs(dirs: &DataDirEnum) -> Result<Vec<DataDir>, Error> {
|
||||
let mut ok = false;
|
||||
for dir in dirs.iter() {
|
||||
let state = match &dir.capacity {
|
||||
Some(cap) if dir.read_only == false => {
|
||||
Some(cap) if !dir.read_only => {
|
||||
let capacity = cap.parse::<bytesize::ByteSize>()
|
||||
.ok_or_message("invalid capacity value")?.as_u64();
|
||||
if capacity == 0 {
|
||||
@@ -336,7 +336,7 @@ fn make_data_dirs(dirs: &DataDirEnum) -> Result<Vec<DataDir>, Error> {
|
||||
capacity,
|
||||
}
|
||||
}
|
||||
None if dir.read_only == true => {
|
||||
None if dir.read_only => {
|
||||
DataDirState::ReadOnly
|
||||
}
|
||||
_ => return Err(Error::Message(format!("data directories in data_dir should have a capacity value or be marked read_only, not the case for {}", dir.path.to_string_lossy()))),
|
||||
|
||||
@@ -569,12 +569,10 @@ impl BlockManager {
|
||||
async {
|
||||
match self.find_block(hash).await {
|
||||
Some(p) => self.read_block_from(hash, &p).await,
|
||||
None => {
|
||||
return Err(Error::Message(format!(
|
||||
"block {:?} not found on node",
|
||||
hash
|
||||
)));
|
||||
}
|
||||
None => Err(Error::Message(format!(
|
||||
"block {:?} not found on node",
|
||||
hash
|
||||
))),
|
||||
}
|
||||
}
|
||||
.bound_record_duration(&self.metrics.block_read_duration)
|
||||
|
||||
+1
-1
@@ -558,7 +558,7 @@ impl Worker for RebalanceWorker {
|
||||
}
|
||||
|
||||
fn status(&self) -> WorkerStatus {
|
||||
let t_cur = self.t_finished.unwrap_or_else(|| now_msec());
|
||||
let t_cur = self.t_finished.unwrap_or_else(now_msec);
|
||||
let rate = self.moved_bytes / std::cmp::max(1, (t_cur - self.t_started) / 1000);
|
||||
let mut freeform = vec![
|
||||
format!("Blocks moved: {}", self.moved),
|
||||
|
||||
Reference in New Issue
Block a user