Skip to content

Commit

Permalink
Address some novel beta clippy lints
Browse files Browse the repository at this point in the history
They are new to stable, so can't be explicitly allowed. Fix the ones
that can be fixed and mark the other as a global allow.

Signed-off-by: mulhern <[email protected]>
  • Loading branch information
mulkieran committed Sep 2, 2020
1 parent 179b917 commit 53f2d31
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 19 deletions.
11 changes: 4 additions & 7 deletions src/engine/strat_engine/backstore/backstore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -556,13 +556,10 @@ impl Backstore {
pub fn teardown(&mut self) -> StratisResult<()> {
match self.cache {
Some(ref mut cache) => cache.teardown(get_dm()),
None => {
if let Some(ref mut linear) = self.linear {
linear.teardown(get_dm())
} else {
Ok(())
}
}
None => self
.linear
.as_mut()
.map_or(Ok(()), |linear| linear.teardown(get_dm())),
}
.map_err(|e| e.into())
}
Expand Down
6 changes: 1 addition & 5 deletions src/engine/strat_engine/backstore/metadata/static_header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,11 +240,7 @@ impl StaticHeader {
where
F: Seek + SyncAll,
{
if let Some(sh) = maybe_sh {
write_header(f, sh, repair_location)
} else {
Err(sh_error)
}
maybe_sh.map_or(Err(sh_error), |sh| write_header(f, sh, repair_location))
}

// Action taken when both sigblock locations are analyzed without encountering an error.
Expand Down
11 changes: 4 additions & 7 deletions src/engine/strat_engine/keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -430,12 +430,9 @@ impl KeyActions for StratKeyActions {
fn unset(&mut self, key_desc: &str) -> StratisResult<DeleteAction<()>> {
let keyring_id = get_persistent_keyring()?;

if let Some(key_id) =
search_key(keyring_id, &KeyDescription::try_from(key_desc.to_string())?)?
{
unset_key(key_id).map(|_| DeleteAction::Deleted(()))
} else {
Ok(DeleteAction::Identity)
}
search_key(keyring_id, &KeyDescription::try_from(key_desc.to_string())?)?
.map_or(Ok(DeleteAction::Identity), |key_id| {
unset_key(key_id).map(|_| DeleteAction::Deleted(()))
})
}
}
3 changes: 3 additions & 0 deletions src/engine/strat_engine/liminal/liminal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,9 @@ impl LiminalDevices {
let stratis_identifiers = info.stratis_identifiers();
let pool_uuid = stratis_identifiers.pool_uuid;
let device_uuid = stratis_identifiers.device_uuid;
// GitHub issue:
// https://github.com/rust-lang/rust-clippy/issues/5822
#[allow(clippy::all)]
if let Some((_, pool)) = pools.get_by_uuid(pool_uuid) {
if pool.get_strat_blockdev(device_uuid).is_some() {
warn!("udev reports that a device with {} that appears to belong to a pool with UUID {} has just been removed; this is likely to result in data loss",
Expand Down

0 comments on commit 53f2d31

Please sign in to comment.