diff options
| author | Linus Färnstrand <linus@mullvad.net> | 2019-03-26 12:47:08 +0100 |
|---|---|---|
| committer | Linus Färnstrand <linus@mullvad.net> | 2019-03-26 12:47:08 +0100 |
| commit | 492e60e9c4907e3574ef6137a68215d5303012d7 (patch) | |
| tree | c987fa46f4e0e61667d963aaee8f2dc16e4e3302 | |
| parent | 9fa1fcd1ec7adc25e0302850ee474b72cfb8893f (diff) | |
| download | mullvadvpn-492e60e9c4907e3574ef6137a68215d5303012d7.tar.xz mullvadvpn-492e60e9c4907e3574ef6137a68215d5303012d7.zip | |
Get rid of clone/allocation in CLI location printing
| -rw-r--r-- | mullvad-cli/src/cmds/status.rs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/mullvad-cli/src/cmds/status.rs b/mullvad-cli/src/cmds/status.rs index 29ce0d2c6d..f39d9cef68 100644 --- a/mullvad-cli/src/cmds/status.rs +++ b/mullvad-cli/src/cmds/status.rs @@ -87,12 +87,13 @@ fn print_location(rpc: &mut DaemonRpcClient) -> Result<()> { if let Some(ipv6) = location.ipv6 { println!("IPv6: {}", ipv6); } - let city_and_country = if let Some(city) = location.city { - format!("{}, {}", city, location.country) - } else { - location.country.clone() - }; - println!("Location: {}", city_and_country); + + print!("Location: "); + if let Some(city) = location.city { + print!("{}, ", city); + } + println!("{}", location.country); + println!( "Position: {:.5}°N, {:.5}°W", location.latitude, location.longitude |
