diff --git a/src/efi.rs b/src/efi.rs index 86949c8..2d76754 100644 --- a/src/efi.rs +++ b/src/efi.rs @@ -258,14 +258,18 @@ impl Default for AuthVariable { } impl Volume { - pub fn boot_entries(&self) -> BootEntryIter { // XXX - just store the iterator in the struct? - let mut vars: Vec<&AuthVariable> = self.vars.iter().filter(|&v| - v.name.starts_with("Boot0") && - v.state == VAR_ADDED && - v.guid.to_string() == EFI_GLOBAL_VARIABLE_GUID.to_string()) - .collect(); + let mut vars: Vec<&AuthVariable> = self + .vars + .iter() + .filter(|&v| { + v.name.starts_with("Boot0") + && v.state == VAR_ADDED + && v.guid.to_string() + == EFI_GLOBAL_VARIABLE_GUID.to_string() + }) + .collect(); vars.reverse(); BootEntryIter { vars } } @@ -289,9 +293,7 @@ impl Volume { self.vars.retain(|v| { v.state == VAR_ADDED || (v.state == (VAR_ADDED & VAR_IN_DELETED_TRANSITION) - && !known.contains( - &format!("{}/{}", v.guid, v.name), - )) + && !known.contains(&format!("{}/{}", v.guid, v.name))) }); // Now promote any remaining ADDED/IN_DELETED_TRANSITION entries @@ -551,12 +553,9 @@ impl fmt::Debug for BootEntryType { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}", match self { - BootEntryType::PCI(f, d) => - format!("PCI {}.{}", d, f), - BootEntryType::App(ref guid) => - format!("App {}", guid), - BootEntryType::Path(ref path) => - format!("Path {}", path), + BootEntryType::PCI(f, d) => format!("PCI {}.{}", d, f), + BootEntryType::App(ref guid) => format!("App {}", guid), + BootEntryType::Path(ref path) => format!("Path {}", path), BootEntryType::Unknown => "unknown".to_string(), } ) diff --git a/src/main.rs b/src/main.rs index c4b6842..a6e6a7f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -13,8 +13,6 @@ extern crate serde_json; #[macro_use] extern crate lazy_static; - - mod efi; #[derive(Parser, Debug)] @@ -134,7 +132,7 @@ fn main() { } if let Some(ref var) = args.remove { - fv.remove_var(&var, &efi::EFI_GLOBAL_VARIABLE_GUID.to_string()); + fv.remove_var(var, &efi::EFI_GLOBAL_VARIABLE_GUID.to_string()); changed = true; } @@ -175,12 +173,9 @@ struct BootOptions { } fn list_boot_options(args: &Args, fv: &efi::Volume) { - - let beiter = fv.boot_entries().filter(|v| { - match args.filter { - Some(ref filter) => v.name.contains(filter), - _ => true - } + let beiter = fv.boot_entries().filter(|v| match args.filter { + Some(ref filter) => v.name.contains(filter), + _ => true, }); let opts = BootOptions {