Fix clippy warnings

This commit is contained in:
Roey Darwish Dror 2018-12-04 13:56:51 +02:00
parent 5f30a38b4a
commit f32a90e896
3 changed files with 5 additions and 4 deletions

View File

@ -16,13 +16,14 @@ impl BlockDevice {
.file_name() .file_name()
.and_then(|s| s.to_str()) .and_then(|s| s.to_str())
.map(String::from) .map(String::from)
.ok_or(Error::from(ErrorKind::InvalidDeviceName))?; .ok_or_else(|| Error::from(ErrorKind::InvalidDeviceName))?;
debug!( debug!(
"path: {:?}, real path: {:?}, device name: {:?}", "path: {:?}, real path: {:?}, device name: {:?}",
path, real_path, device_name path, real_path, device_name
); );
drop(path);
let _self = Self { name: device_name }; let _self = Self { name: device_name };
if !(_self.is_removable()? || _self.is_loop_device()) { if !(_self.is_removable()? || _self.is_loop_device()) {
return Err(ErrorKind::DangerousDevice)?; return Err(ErrorKind::DangerousDevice)?;

View File

@ -95,6 +95,6 @@ impl From<ErrorKind> for Error {
impl From<Context<ErrorKind>> for Error { impl From<Context<ErrorKind>> for Error {
fn from(inner: Context<ErrorKind>) -> Error { fn from(inner: Context<ErrorKind>) -> Error {
Error { inner: inner } Error { inner }
} }
} }

View File

@ -6,14 +6,14 @@ use nix::mount::{mount, umount, MsFlags};
use std::borrow::Cow; use std::borrow::Cow;
use std::path::Path; use std::path::Path;
#[derive(Debug)] #[derive(Debug, Clone, Copy)]
pub enum Filesystem { pub enum Filesystem {
Ext4, Ext4,
Vfat, Vfat,
} }
impl Filesystem { impl Filesystem {
fn to_type(&self) -> &'static str { fn to_type(self) -> &'static str {
match self { match self {
Filesystem::Ext4 => "ext4", Filesystem::Ext4 => "ext4",
Filesystem::Vfat => "vfat", Filesystem::Vfat => "vfat",