use if-let
This commit is contained in:
parent
a5c55115cf
commit
6c8298aeec
1 changed files with 17 additions and 18 deletions
|
@ -309,8 +309,7 @@ struct Message {
|
|||
async fn handle_list(conf: Config, args: List) -> Result<()> {
|
||||
// Use provided zones or list all in config
|
||||
let known_zones: HashSet<_> = conf.zone.values().map(|zone| &zone.id).collect();
|
||||
let zones: Vec<_> = match args.zones {
|
||||
Some(zones) => {
|
||||
let zones: Vec<_> = if let Some(zones) = args.zones {
|
||||
// These zones may be human readable. Map them to zone IDs.
|
||||
zones
|
||||
.into_iter()
|
||||
|
@ -327,8 +326,8 @@ async fn handle_list(conf: Config, args: List) -> Result<()> {
|
|||
None
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
None => known_zones.into_iter().cloned().collect(),
|
||||
} else {
|
||||
known_zones.into_iter().cloned().collect()
|
||||
};
|
||||
|
||||
let mut output = BTreeMap::new();
|
||||
|
|
Loading…
Reference in a new issue