summaryrefslogtreecommitdiffstats
path: root/src/stats.rs
diff options
context:
space:
mode:
authorrabite <rabite@posteo.de>2019-06-16 12:43:08 +0200
committerrabite <rabite@posteo.de>2019-06-16 12:43:08 +0200
commit48cbbf3b8850992d23bf822be46144fbf0e443b5 (patch)
treedf17921997404d2837f88b5352ba25da6bc2b00f /src/stats.rs
parent8f5ad6b3c947fa058d34a749135e0cdcfd87304b (diff)
some small clean-ups
Diffstat (limited to 'src/stats.rs')
-rw-r--r--src/stats.rs12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/stats.rs b/src/stats.rs
index 1d93e1b..b996772 100644
--- a/src/stats.rs
+++ b/src/stats.rs
@@ -58,19 +58,21 @@ impl FsStat {
}
pub trait FsExt {
- fn get_dev(&self) -> String;
+ fn get_dev(&self) -> Option<String>;
fn get_total(&self) -> String;
fn get_free(&self) -> String;
}
impl FsExt for Filesystem {
- fn get_dev(&self) -> String {
+ fn get_dev(&self) -> Option<String> {
let path = PathBuf::from(&self.fs_mounted_from);
- let dev = match path.components().last() {
- Some(Component::Normal(dev)) => dev.to_string_lossy().to_string() + ": ",
+ let dev = path.components().last()?;
+ let dev = match dev {
+ Component::Normal(dev) => dev.to_string_lossy().to_string() + ": ",
+ // zfs on FBSD doesn't return a device path
_ => "".to_string()
};
- dev
+ Some(dev)
}
fn get_total(&self) -> String {