Skip to content

Commit

Permalink
Merge pull request #3742 from bgurney-rh/clippy-1.84
Browse files Browse the repository at this point in the history
Fix clippy 1.84 linting errors
  • Loading branch information
mulkieran authored Jan 9, 2025
2 parents 5654874 + 66d3066 commit 086180c
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/dbus_api/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ impl DbusTreeHandler {
opath
.get_data()
.as_ref()
.map_or(false, |op_cxt| op_cxt.parent == item)
.is_some_and(|op_cxt| op_cxt.parent == item)
}) {
if let StratisUuid::Fs(_) = opath
.get_data()
Expand Down
5 changes: 1 addition & 4 deletions src/engine/strat_engine/liminal/liminal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1017,10 +1017,7 @@ impl LiminalDevices {
event: &UdevEngineEvent,
) -> Option<(Name, PoolUuid, AnyPool)> {
let event_type = event.event_type();
let device_path = match event.device().devnode() {
Some(d) => d,
None => return None,
};
let device_path = event.device().devnode()?;
let device_info = match event_type {
libudev::EventType::Add | libudev::EventType::Change => {
if device_path.exists() {
Expand Down
4 changes: 2 additions & 2 deletions src/engine/strat_engine/pool/v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1802,7 +1802,7 @@ mod tests {
.tempdir()
.unwrap();
let new_file = tmp_dir.path().join("stratis_test.txt");
let write_block = &[0; 512_000];
let write_block = vec![0; 512_000].into_boxed_slice();

{
let (_, fs) = pool.get_filesystem(fs_uuid).unwrap();
Expand All @@ -1823,7 +1823,7 @@ mod tests {
.open(new_file)
.unwrap();
while !pool.out_of_alloc_space() {
f.write_all(write_block).unwrap();
f.write_all(&write_block).unwrap();
f.sync_all().unwrap();
match pool {
AnyPool::V1(p) => p.event_on(pool_uuid, &pool_name).unwrap(),
Expand Down
4 changes: 2 additions & 2 deletions src/engine/strat_engine/pool/v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1744,7 +1744,7 @@ mod tests {
.tempdir()
.unwrap();
let new_file = tmp_dir.path().join("stratis_test.txt");
let write_block = &[0; 512_000];
let write_block = vec![0; 512_000].into_boxed_slice();

{
let (_, fs) = pool.get_filesystem(fs_uuid).unwrap();
Expand All @@ -1765,7 +1765,7 @@ mod tests {
.open(new_file)
.unwrap();
while !pool.out_of_alloc_space() {
f.write_all(write_block).unwrap();
f.write_all(&write_block).unwrap();
f.sync_all().unwrap();
match pool {
AnyPool::V1(p) => p.event_on(pool_uuid, &pool_name).unwrap(),
Expand Down
2 changes: 1 addition & 1 deletion src/engine/strat_engine/udev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,6 @@ where
Ok(enumerator
.scan_devices()?
.filter(|dev| dev.is_initialized())
.find(|x| x.devnode().map_or(false, |d| **device_path == *d))
.find(|x| x.devnode().is_some_and(|d| **device_path == *d))
.map(|ref d| f(&UdevEngineDevice::from(d))))
}
5 changes: 1 addition & 4 deletions src/engine/structures/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,7 @@ where

/// Get mutable item by name.
pub fn get_mut_by_name(&mut self, name: &str) -> Option<(U, &mut T)> {
let uuid = match self.name_to_uuid.get(name) {
Some(uuid) => uuid,
None => return None,
};
let uuid = self.name_to_uuid.get(name)?;
self.items
.get_mut(uuid)
.map(|&mut (_, ref mut item)| (*uuid, item))
Expand Down

0 comments on commit 086180c

Please sign in to comment.