From 951c3bdd2bf27e93bc7ef63cca2315ceb1268128 Mon Sep 17 00:00:00 2001 From: Bardi Harborow Date: Sat, 21 Nov 2026 22:21:09 +1100 Subject: [PATCH] Add `#[must_use]` to `Ip*Addr::as_octets` methods --- library/core/src/net/ip_addr.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/library/core/src/net/ip_addr.rs b/library/core/src/net/ip_addr.rs index aeb3ceab25e05..e04fa4f24aaf2 100644 --- a/library/core/src/net/ip_addr.rs +++ b/library/core/src/net/ip_addr.rs @@ -544,6 +544,7 @@ impl IpAddr { /// &[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) /// ``` #[unstable(feature = "ip_as_octets", issue = "137259")] + #[must_use] #[inline] pub const fn as_octets(&self) -> &[u8] { match self { @@ -730,6 +731,7 @@ impl Ipv4Addr { /// assert_eq!(addr.as_octets(), &[127, 0, 0, 1]); /// ``` #[unstable(feature = "ip_as_octets", issue = "137259")] + #[must_use] #[inline] pub const fn as_octets(&self) -> &[u8; 4] { &self.octets @@ -2160,6 +2162,7 @@ impl Ipv6Addr { /// &[255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) /// ``` #[unstable(feature = "ip_as_octets", issue = "137259")] + #[must_use] #[inline] pub const fn as_octets(&self) -> &[u8; 16] { &self.octets