Skip to content

Commit

Permalink
Merge pull request #24 from zvonkok/clippy
Browse files Browse the repository at this point in the history
Fix Display and assert_eq for clippy
  • Loading branch information
Apokleos committed Jun 6, 2024
2 parents 2b8c61b + c890be1 commit c871573
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
16 changes: 9 additions & 7 deletions src/container_edits_unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use std::{
io::{Error, ErrorKind},
os::unix::fs::{FileTypeExt, MetadataExt},
path::Path,
fmt,
};

use anyhow::Result;
Expand All @@ -12,13 +13,14 @@ pub enum DeviceType {
Fifo,
}

impl ToString for DeviceType {
fn to_string(&self) -> String {
match self {
DeviceType::Block => "b".to_string(),
DeviceType::Char => "c".to_string(),
DeviceType::Fifo => "p".to_string(),
}
impl fmt::Display for DeviceType {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let s = match self {
DeviceType::Block => "b",
DeviceType::Char => "c",
DeviceType::Fifo => "p",
};
write!(f, "{}", s)
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ mod tests {
let name = "0";
let device = parser::qualified_name(vendor, class, name);
assert_eq!(device, "nvidia.com/gpu=0");
assert_eq!(parser::is_qualified_name(&device), true);
assert!(parser::is_qualified_name(&device));
}

#[test]
Expand Down

0 comments on commit c871573

Please sign in to comment.