mirror of
https://github.com/philmmanjaro/alma.git
synced 2025-07-26 23:19:29 +02:00
Make Clippy happy
This commit is contained in:
parent
a56ed3752b
commit
4ea5807a5a
@ -7,8 +7,12 @@ stages:
|
|||||||
vmImage: 'ubuntu-16.04'
|
vmImage: 'ubuntu-16.04'
|
||||||
container: 'rust:latest'
|
container: 'rust:latest'
|
||||||
steps:
|
steps:
|
||||||
|
- script: cargo fmt -- --check
|
||||||
|
displayName: Check Formatting
|
||||||
- script: cargo check --all
|
- script: cargo check --all
|
||||||
displayName: Run check
|
displayName: Check
|
||||||
|
- script: cargo clippy
|
||||||
|
displayName: Clippy
|
||||||
|
|
||||||
- stage: Build
|
- stage: Build
|
||||||
jobs:
|
jobs:
|
||||||
|
@ -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> {
|
fn create(command: CreateCommand, running: Arc<AtomicBool>) -> Result<(), Error> {
|
||||||
let presets = presets::Presets::load(&command.presets)?;
|
let presets = presets::Presets::load(&command.presets)?;
|
||||||
|
|
||||||
|
@ -16,22 +16,19 @@ pub struct StorageDevice<'a> {
|
|||||||
|
|
||||||
impl<'a> StorageDevice<'a> {
|
impl<'a> StorageDevice<'a> {
|
||||||
pub fn from_path(path: &'a Path) -> Result<Self, Error> {
|
pub fn from_path(path: &'a Path) -> Result<Self, Error> {
|
||||||
let real_path = path.canonicalize().context(ErrorKind::DeviceQuery)?;
|
debug!("path: {:?}", path);
|
||||||
let device_name = real_path
|
let path = path.canonicalize().context(ErrorKind::DeviceQuery)?;
|
||||||
|
let device_name = path
|
||||||
.file_name()
|
.file_name()
|
||||||
.and_then(|s| s.to_str())
|
.and_then(|s| s.to_str())
|
||||||
.map(String::from)
|
.map(String::from)
|
||||||
.ok_or_else(|| Error::from(ErrorKind::InvalidDeviceName))?;
|
.ok_or_else(|| Error::from(ErrorKind::InvalidDeviceName))?;
|
||||||
|
|
||||||
debug!(
|
debug!("real path: {:?}, device name: {:?}", path, device_name);
|
||||||
"path: {:?}, real path: {:?}, device name: {:?}",
|
|
||||||
path, real_path, device_name
|
|
||||||
);
|
|
||||||
|
|
||||||
drop(path);
|
|
||||||
let _self = Self {
|
let _self = Self {
|
||||||
name: device_name,
|
name: device_name,
|
||||||
path: real_path,
|
path,
|
||||||
origin: PhantomData,
|
origin: PhantomData,
|
||||||
};
|
};
|
||||||
if !(_self.is_removable_device()? || _self.is_loop_device()) {
|
if !(_self.is_removable_device()? || _self.is_loop_device()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user