Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix clippy 1.84 linting errors #3742

Merged
merged 4 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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