Make Clippy happy

This commit is contained in:
Roey Darwish Dror 2019-08-01 11:03:54 +03:00
parent a56ed3752b
commit 4ea5807a5a
3 changed files with 11 additions and 9 deletions

View File

@ -7,8 +7,12 @@ stages:
vmImage: 'ubuntu-16.04'
container: 'rust:latest'
steps:
- script: cargo fmt -- --check
displayName: Check Formatting
- script: cargo check --all
displayName: Run check
displayName: Check
- script: cargo clippy
displayName: Clippy
- stage: Build
jobs:

View File

@ -126,6 +126,7 @@ fn select_block_device(running: Arc<AtomicBool>) -> Result<PathBuf, Error> {
}
}
#[allow(clippy::cognitive_complexity)]
fn create(command: CreateCommand, running: Arc<AtomicBool>) -> Result<(), Error> {
let presets = presets::Presets::load(&command.presets)?;

View File

@ -16,22 +16,19 @@ pub struct StorageDevice<'a> {
impl<'a> StorageDevice<'a> {
pub fn from_path(path: &'a Path) -> Result<Self, Error> {
let real_path = path.canonicalize().context(ErrorKind::DeviceQuery)?;
let device_name = real_path
debug!("path: {:?}", path);
let path = path.canonicalize().context(ErrorKind::DeviceQuery)?;
let device_name = path
.file_name()
.and_then(|s| s.to_str())
.map(String::from)
.ok_or_else(|| Error::from(ErrorKind::InvalidDeviceName))?;
debug!(
"path: {:?}, real path: {:?}, device name: {:?}",
path, real_path, device_name
);
debug!("real path: {:?}, device name: {:?}", path, device_name);
drop(path);
let _self = Self {
name: device_name,
path: real_path,
path,
origin: PhantomData,
};
if !(_self.is_removable_device()? || _self.is_loop_device()) {