diff options
Diffstat (limited to 'mullvad-cli/src')
| -rw-r--r-- | mullvad-cli/src/cmds/relay.rs | 47 |
1 files changed, 25 insertions, 22 deletions
diff --git a/mullvad-cli/src/cmds/relay.rs b/mullvad-cli/src/cmds/relay.rs index b56c2c2991..1f2d1f9192 100644 --- a/mullvad-cli/src/cmds/relay.rs +++ b/mullvad-cli/src/cmds/relay.rs @@ -944,33 +944,36 @@ pub async fn resolve_location_constraint( match relay_iter .clone() .find(|relay| relay.hostname.to_lowercase() == location_constraint_args.country) - { Some(matching_relay) => { - if relay_filter(&matching_relay) { - Ok(Constraint::Only(relay_to_geographical_constraint( - matching_relay, - ))) - } else { - bail!( - "The relay `{}` is not valid for this operation", - location_constraint_args.country - ) + { + Some(matching_relay) => { + if relay_filter(&matching_relay) { + Ok(Constraint::Only(relay_to_geographical_constraint( + matching_relay, + ))) + } else { + bail!( + "The relay `{}` is not valid for this operation", + location_constraint_args.country + ) + } } - } _ => { - // The Constraint was not a relay, assuming it to be a location - let location_constraint: Constraint<GeographicLocationConstraint> = - Constraint::from(location_constraint_args); + _ => { + // The Constraint was not a relay, assuming it to be a location + let location_constraint: Constraint<GeographicLocationConstraint> = + Constraint::from(location_constraint_args); - // If the location constraint was not "any", then validate the country/city - if let Constraint::Only(constraint) = &location_constraint { - let found = relay_iter.clone().any(|relay| constraint.matches(&relay)); + // If the location constraint was not "any", then validate the country/city + if let Constraint::Only(constraint) = &location_constraint { + let found = relay_iter.clone().any(|relay| constraint.matches(&relay)); - if !found { - bail!("Invalid location argument"); + if !found { + bail!("Invalid location argument"); + } } - } - Ok(location_constraint) - }} + Ok(location_constraint) + } + } } /// Return a list of all relays that are active and not bridges |
