diff options
author | Thomas Mühlbacher <tmuehlbacher@posteo.net> | 2024-05-22 22:21:31 +0200 |
---|---|---|
committer | Thomas Mühlbacher <tmuehlbacher@posteo.net> | 2024-05-22 22:33:40 +0200 |
commit | 3882d1b1e4a8a0b8453d08fdf380bb1b3e3be510 (patch) | |
tree | 48e17a99e162eff186be3d1f493df8cd247555e5 /src | |
parent | 3488d4f15f3d4e23ab37fd4c19f02805f55081d3 (diff) |
refactor: manually fix remaining clippy lints
Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
Diffstat (limited to 'src')
-rw-r--r-- | src/commands/mount.rs | 9 | ||||
-rw-r--r-- | src/key.rs | 2 |
2 files changed, 6 insertions, 5 deletions
diff --git a/src/commands/mount.rs b/src/commands/mount.rs index 991fedcf..05c586a8 100644 --- a/src/commands/mount.rs +++ b/src/commands/mount.rs @@ -4,7 +4,7 @@ use std::collections::HashMap; use clap::Parser; use uuid::Uuid; use std::io::{stdout, IsTerminal}; -use std::path::PathBuf; +use std::path::{Path, PathBuf}; use std::{fs, str, env}; use crate::key; use crate::key::UnlockPolicy; @@ -101,11 +101,11 @@ fn do_mount( mount_inner(device, target, "bcachefs", mountflags, data) } -fn read_super_silent(path: &std::path::PathBuf) -> anyhow::Result<bch_sb_handle> { +fn read_super_silent(path: impl AsRef<Path>) -> anyhow::Result<bch_sb_handle> { let mut opts = bcachefs::bch_opts::default(); opt_set!(opts, noexcl, 1); - bch_bindgen::sb_io::read_super_silent(path, opts) + bch_bindgen::sb_io::read_super_silent(path.as_ref(), opts) } fn device_property_map(dev: &udev::Device) -> HashMap<String, String> { @@ -158,7 +158,7 @@ fn get_super_blocks( Ok(devices .iter() .filter_map(|dev| { - read_super_silent(&PathBuf::from(dev)) + read_super_silent(PathBuf::from(dev)) .ok() .map(|sb| (PathBuf::from(dev), sb)) }) @@ -203,6 +203,7 @@ fn get_devices_by_uuid( get_super_blocks(uuid, &devices) } +#[allow(clippy::type_complexity)] fn get_uuid_for_dev_node( udev_bcachefs: &HashMap<String, Vec<String>>, device: &std::path::PathBuf, @@ -98,7 +98,7 @@ fn ask_for_passphrase(sb: &bch_sb_handle) -> anyhow::Result<()> { } const BCH_KEY_MAGIC: &str = "bch**key"; -fn unlock_master_key(sb: &bch_sb_handle, passphrase: &String) -> anyhow::Result<()> { +fn unlock_master_key(sb: &bch_sb_handle, passphrase: &str) -> anyhow::Result<()> { use bch_bindgen::bcachefs::{self, bch2_chacha_encrypt_key, bch_encrypted_key, bch_key}; use byteorder::{LittleEndian, ReadBytesExt}; use std::os::raw::c_char; |