diff options
| author | metamuffin <metamuffin@disroot.org> | 2025-10-11 00:24:11 +0200 |
|---|---|---|
| committer | metamuffin <metamuffin@disroot.org> | 2025-10-11 00:24:11 +0200 |
| commit | e68a9eb5e9e15372313f9017be4a2d58fb690bfc (patch) | |
| tree | 690287a2c71d87c2955e992f1e9575166237188a /server/src/network | |
| parent | 3fe8ba7f1b9fa7e38fa03f55fd898c8ca2a0e996 (diff) | |
| download | hurrycurry-e68a9eb5e9e15372313f9017be4a2d58fb690bfc.tar hurrycurry-e68a9eb5e9e15372313f9017be4a2d58fb690bfc.tar.bz2 hurrycurry-e68a9eb5e9e15372313f9017be4a2d58fb690bfc.tar.zst | |
clippy + fmt; start using if let chains
Diffstat (limited to 'server/src/network')
| -rw-r--r-- | server/src/network/upnp.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/server/src/network/upnp.rs b/server/src/network/upnp.rs index 8ad79588..a443a223 100644 --- a/server/src/network/upnp.rs +++ b/server/src/network/upnp.rs @@ -15,11 +15,11 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */ -use anyhow::{bail, Result}; +use anyhow::{Result, bail}; use get_if_addrs::get_if_addrs; use igd::{ - aio::{search_gateway, Gateway}, PortMappingProtocol, SearchOptions, + aio::{Gateway, search_gateway}, }; use log::{error, info}; use std::{ @@ -61,11 +61,11 @@ async fn upnp_setup() -> Result<(Gateway, Ipv4Addr)> { info!("IGD address is {}", gateway.addr); for i in get_if_addrs()? { let a = i.addr.ip(); - if !a.is_loopback() { - if let IpAddr::V4(a) = a { - info!("local v4 address is {a}"); - return Ok((gateway, a)); - } + if !a.is_loopback() + && let IpAddr::V4(a) = a + { + info!("local v4 address is {a}"); + return Ok((gateway, a)); } } bail!("no good local address found") |