summaryrefslogtreecommitdiffhomepage
path: root/mullvad-cli/src
diff options
context:
space:
mode:
authorSebastian Holmin <sebastian.holmin@mullvad.net>2025-02-11 14:34:17 +0100
committerSebastian Holmin <sebastian.holmin@mullvad.net>2025-02-12 10:15:31 +0100
commit74d800fa2274517622b891745b629f62d6239a8a (patch)
tree338c9a93d99afaeca72a4861a5f1ea31a27b7a3f /mullvad-cli/src
parentf55ec2043a07f625c87fad4368bb252e09162863 (diff)
downloadmullvadvpn-74d800fa2274517622b891745b629f62d6239a8a.tar.xz
mullvadvpn-74d800fa2274517622b891745b629f62d6239a8a.zip
Format workspace
The 2024 edition contains new formatting rules. All of these are not compatible with the 2021 formatting style, but most of them are. To change the formatting to be as close to the new style as possible while remaining compatible with the 2021 edition, I first ran `cargo +beta fmt` with the edition set to 2024, then, with the edition set to 2021, I ran `cargo fmt`.
Diffstat (limited to 'mullvad-cli/src')
-rw-r--r--mullvad-cli/src/cmds/relay.rs47
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