diff options
| author | Dániel Buga <[email protected]> | 2023-09-02 07:44:10 +0200 |
|---|---|---|
| committer | Dániel Buga <[email protected]> | 2023-09-02 08:39:52 +0200 |
| commit | 0c66636d003979c3aecff36c9e03e87f34147a94 (patch) | |
| tree | d79b1578cb559a40f0bfe8c2a1b33263cecc4364 /embassy-net/src/lib.rs | |
| parent | 8339423a2f194d31f3f26d956f68dfcef46f8891 (diff) | |
Use fmt::unwrap
Diffstat (limited to 'embassy-net/src/lib.rs')
| -rw-r--r-- | embassy-net/src/lib.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/embassy-net/src/lib.rs b/embassy-net/src/lib.rs index 3a385fad6..c2575267c 100644 --- a/embassy-net/src/lib.rs +++ b/embassy-net/src/lib.rs | |||
| @@ -616,7 +616,7 @@ impl<D: Driver + 'static> Inner<D> { | |||
| 616 | } | 616 | } |
| 617 | 617 | ||
| 618 | // Configure it | 618 | // Configure it |
| 619 | let socket = _s.sockets.get_mut::<dhcpv4::Socket>(self.dhcp_socket.unwrap()); | 619 | let socket = _s.sockets.get_mut::<dhcpv4::Socket>(unwrap!(self.dhcp_socket)); |
| 620 | socket.set_ignore_naks(c.ignore_naks); | 620 | socket.set_ignore_naks(c.ignore_naks); |
| 621 | socket.set_max_lease_duration(c.max_lease_duration.map(crate::time::duration_to_smoltcp)); | 621 | socket.set_max_lease_duration(c.max_lease_duration.map(crate::time::duration_to_smoltcp)); |
| 622 | socket.set_ports(c.server_port, c.client_port); | 622 | socket.set_ports(c.server_port, c.client_port); |
| @@ -656,12 +656,12 @@ impl<D: Driver + 'static> Inner<D> { | |||
| 656 | debug!(" IP address: {:?}", config.address); | 656 | debug!(" IP address: {:?}", config.address); |
| 657 | debug!(" Default gateway: {:?}", config.gateway); | 657 | debug!(" Default gateway: {:?}", config.gateway); |
| 658 | 658 | ||
| 659 | addrs.push(IpCidr::Ipv4(config.address)).unwrap(); | 659 | unwrap!(addrs.push(IpCidr::Ipv4(config.address)).ok()); |
| 660 | gateway_v4 = config.gateway.into(); | 660 | gateway_v4 = config.gateway.into(); |
| 661 | #[cfg(feature = "dns")] | 661 | #[cfg(feature = "dns")] |
| 662 | for s in &config.dns_servers { | 662 | for s in &config.dns_servers { |
| 663 | debug!(" DNS server: {:?}", s); | 663 | debug!(" DNS server: {:?}", s); |
| 664 | dns_servers.push(s.clone().into()).unwrap(); | 664 | unwrap!(dns_servers.push(s.clone().into()).ok()); |
| 665 | } | 665 | } |
| 666 | } else { | 666 | } else { |
| 667 | info!("IPv4: DOWN"); | 667 | info!("IPv4: DOWN"); |
| @@ -673,12 +673,12 @@ impl<D: Driver + 'static> Inner<D> { | |||
| 673 | debug!(" IP address: {:?}", config.address); | 673 | debug!(" IP address: {:?}", config.address); |
| 674 | debug!(" Default gateway: {:?}", config.gateway); | 674 | debug!(" Default gateway: {:?}", config.gateway); |
| 675 | 675 | ||
| 676 | addrs.push(IpCidr::Ipv6(config.address)).unwrap(); | 676 | unwrap!(addrs.push(IpCidr::Ipv6(config.address)).ok()); |
| 677 | gateway_v6 = config.gateway.into(); | 677 | gateway_v6 = config.gateway.into(); |
| 678 | #[cfg(feature = "dns")] | 678 | #[cfg(feature = "dns")] |
| 679 | for s in &config.dns_servers { | 679 | for s in &config.dns_servers { |
| 680 | debug!(" DNS server: {:?}", s); | 680 | debug!(" DNS server: {:?}", s); |
| 681 | dns_servers.push(s.clone().into()).unwrap(); | 681 | unwrap!(dns_servers.push(s.clone().into()).ok()); |
| 682 | } | 682 | } |
| 683 | } else { | 683 | } else { |
| 684 | info!("IPv6: DOWN"); | 684 | info!("IPv6: DOWN"); |
| @@ -690,13 +690,13 @@ impl<D: Driver + 'static> Inner<D> { | |||
| 690 | // Apply gateways | 690 | // Apply gateways |
| 691 | #[cfg(feature = "proto-ipv4")] | 691 | #[cfg(feature = "proto-ipv4")] |
| 692 | if let Some(gateway) = gateway_v4 { | 692 | if let Some(gateway) = gateway_v4 { |
| 693 | s.iface.routes_mut().add_default_ipv4_route(gateway).unwrap(); | 693 | unwrap!(s.iface.routes_mut().add_default_ipv4_route(gateway)); |
| 694 | } else { | 694 | } else { |
| 695 | s.iface.routes_mut().remove_default_ipv4_route(); | 695 | s.iface.routes_mut().remove_default_ipv4_route(); |
| 696 | } | 696 | } |
| 697 | #[cfg(feature = "proto-ipv6")] | 697 | #[cfg(feature = "proto-ipv6")] |
| 698 | if let Some(gateway) = gateway_v6 { | 698 | if let Some(gateway) = gateway_v6 { |
| 699 | s.iface.routes_mut().add_default_ipv6_route(gateway).unwrap(); | 699 | unwrap!(s.iface.routes_mut().add_default_ipv6_route(gateway)); |
| 700 | } else { | 700 | } else { |
| 701 | s.iface.routes_mut().remove_default_ipv6_route(); | 701 | s.iface.routes_mut().remove_default_ipv6_route(); |
| 702 | } | 702 | } |
