@@ -233,6 +233,7 @@ impl IpAddr {
233233 /// ```
234234 #[ rustc_const_stable( feature = "const_ip" , since = "1.50.0" ) ]
235235 #[ stable( feature = "ip_shared" , since = "1.12.0" ) ]
236+ #[ must_use]
236237 #[ inline]
237238 pub const fn is_unspecified ( & self ) -> bool {
238239 match self {
@@ -256,6 +257,7 @@ impl IpAddr {
256257 /// ```
257258 #[ rustc_const_stable( feature = "const_ip" , since = "1.50.0" ) ]
258259 #[ stable( feature = "ip_shared" , since = "1.12.0" ) ]
260+ #[ must_use]
259261 #[ inline]
260262 pub const fn is_loopback ( & self ) -> bool {
261263 match self {
@@ -281,6 +283,7 @@ impl IpAddr {
281283 /// ```
282284 #[ rustc_const_unstable( feature = "const_ip" , issue = "76205" ) ]
283285 #[ unstable( feature = "ip" , issue = "27709" ) ]
286+ #[ must_use]
284287 #[ inline]
285288 pub const fn is_global ( & self ) -> bool {
286289 match self {
@@ -304,6 +307,7 @@ impl IpAddr {
304307 /// ```
305308 #[ rustc_const_stable( feature = "const_ip" , since = "1.50.0" ) ]
306309 #[ stable( feature = "ip_shared" , since = "1.12.0" ) ]
310+ #[ must_use]
307311 #[ inline]
308312 pub const fn is_multicast ( & self ) -> bool {
309313 match self {
@@ -332,6 +336,7 @@ impl IpAddr {
332336 /// ```
333337 #[ rustc_const_unstable( feature = "const_ip" , issue = "76205" ) ]
334338 #[ unstable( feature = "ip" , issue = "27709" ) ]
339+ #[ must_use]
335340 #[ inline]
336341 pub const fn is_documentation ( & self ) -> bool {
337342 match self {
@@ -356,6 +361,7 @@ impl IpAddr {
356361 /// assert_eq!(IpAddr::V6(Ipv6Addr::new(0x2001, 0x2, 0, 0, 0, 0, 0, 0)).is_benchmarking(), true);
357362 /// ```
358363 #[ unstable( feature = "ip" , issue = "27709" ) ]
364+ #[ must_use]
359365 #[ inline]
360366 pub const fn is_benchmarking ( & self ) -> bool {
361367 match self {
@@ -379,6 +385,7 @@ impl IpAddr {
379385 /// ```
380386 #[ rustc_const_stable( feature = "const_ip" , since = "1.50.0" ) ]
381387 #[ stable( feature = "ipaddr_checker" , since = "1.16.0" ) ]
388+ #[ must_use]
382389 #[ inline]
383390 pub const fn is_ipv4 ( & self ) -> bool {
384391 matches ! ( self , IpAddr :: V4 ( _) )
@@ -399,6 +406,7 @@ impl IpAddr {
399406 /// ```
400407 #[ rustc_const_stable( feature = "const_ip" , since = "1.50.0" ) ]
401408 #[ stable( feature = "ipaddr_checker" , since = "1.16.0" ) ]
409+ #[ must_use]
402410 #[ inline]
403411 pub const fn is_ipv6 ( & self ) -> bool {
404412 matches ! ( self , IpAddr :: V6 ( _) )
@@ -527,6 +535,7 @@ impl Ipv4Addr {
527535 /// ```
528536 #[ rustc_const_stable( feature = "const_ipv4" , since = "1.32.0" ) ]
529537 #[ stable( feature = "ip_shared" , since = "1.12.0" ) ]
538+ #[ must_use]
530539 #[ inline]
531540 pub const fn is_unspecified ( & self ) -> bool {
532541 self . inner . s_addr == 0
@@ -548,6 +557,7 @@ impl Ipv4Addr {
548557 /// ```
549558 #[ rustc_const_stable( feature = "const_ipv4" , since = "1.50.0" ) ]
550559 #[ stable( since = "1.7.0" , feature = "ip_17" ) ]
560+ #[ must_use]
551561 #[ inline]
552562 pub const fn is_loopback ( & self ) -> bool {
553563 self . octets ( ) [ 0 ] == 127
@@ -578,6 +588,7 @@ impl Ipv4Addr {
578588 /// ```
579589 #[ rustc_const_stable( feature = "const_ipv4" , since = "1.50.0" ) ]
580590 #[ stable( since = "1.7.0" , feature = "ip_17" ) ]
591+ #[ must_use]
581592 #[ inline]
582593 pub const fn is_private ( & self ) -> bool {
583594 match self . octets ( ) {
@@ -605,6 +616,7 @@ impl Ipv4Addr {
605616 /// ```
606617 #[ rustc_const_stable( feature = "const_ipv4" , since = "1.50.0" ) ]
607618 #[ stable( since = "1.7.0" , feature = "ip_17" ) ]
619+ #[ must_use]
608620 #[ inline]
609621 pub const fn is_link_local ( & self ) -> bool {
610622 matches ! ( self . octets( ) , [ 169 , 254 , ..] )
@@ -680,6 +692,7 @@ impl Ipv4Addr {
680692 /// ```
681693 #[ rustc_const_unstable( feature = "const_ipv4" , issue = "76205" ) ]
682694 #[ unstable( feature = "ip" , issue = "27709" ) ]
695+ #[ must_use]
683696 #[ inline]
684697 pub const fn is_global ( & self ) -> bool {
685698 // check if this address is 192.0.0.9 or 192.0.0.10. These addresses are the only two
@@ -720,6 +733,7 @@ impl Ipv4Addr {
720733 /// ```
721734 #[ rustc_const_unstable( feature = "const_ipv4" , issue = "76205" ) ]
722735 #[ unstable( feature = "ip" , issue = "27709" ) ]
736+ #[ must_use]
723737 #[ inline]
724738 pub const fn is_shared ( & self ) -> bool {
725739 self . octets ( ) [ 0 ] == 100 && ( self . octets ( ) [ 1 ] & 0b1100_0000 == 0b0100_0000 )
@@ -745,6 +759,7 @@ impl Ipv4Addr {
745759 /// ```
746760 #[ rustc_const_unstable( feature = "const_ipv4" , issue = "76205" ) ]
747761 #[ unstable( feature = "ip" , issue = "27709" ) ]
762+ #[ must_use]
748763 #[ inline]
749764 pub const fn is_benchmarking ( & self ) -> bool {
750765 self . octets ( ) [ 0 ] == 198 && ( self . octets ( ) [ 1 ] & 0xfe ) == 18
@@ -779,6 +794,7 @@ impl Ipv4Addr {
779794 /// ```
780795 #[ rustc_const_unstable( feature = "const_ipv4" , issue = "76205" ) ]
781796 #[ unstable( feature = "ip" , issue = "27709" ) ]
797+ #[ must_use]
782798 #[ inline]
783799 pub const fn is_reserved ( & self ) -> bool {
784800 self . octets ( ) [ 0 ] & 240 == 240 && !self . is_broadcast ( )
@@ -802,6 +818,7 @@ impl Ipv4Addr {
802818 /// ```
803819 #[ rustc_const_stable( feature = "const_ipv4" , since = "1.50.0" ) ]
804820 #[ stable( since = "1.7.0" , feature = "ip_17" ) ]
821+ #[ must_use]
805822 #[ inline]
806823 pub const fn is_multicast ( & self ) -> bool {
807824 self . octets ( ) [ 0 ] >= 224 && self . octets ( ) [ 0 ] <= 239
@@ -823,6 +840,7 @@ impl Ipv4Addr {
823840 /// ```
824841 #[ rustc_const_stable( feature = "const_ipv4" , since = "1.50.0" ) ]
825842 #[ stable( since = "1.7.0" , feature = "ip_17" ) ]
843+ #[ must_use]
826844 #[ inline]
827845 pub const fn is_broadcast ( & self ) -> bool {
828846 u32:: from_be_bytes ( self . octets ( ) ) == u32:: from_be_bytes ( Self :: BROADCAST . octets ( ) )
@@ -850,6 +868,7 @@ impl Ipv4Addr {
850868 /// ```
851869 #[ rustc_const_stable( feature = "const_ipv4" , since = "1.50.0" ) ]
852870 #[ stable( since = "1.7.0" , feature = "ip_17" ) ]
871+ #[ must_use]
853872 #[ inline]
854873 pub const fn is_documentation ( & self ) -> bool {
855874 match self . octets ( ) {
@@ -1291,6 +1310,7 @@ impl Ipv6Addr {
12911310 /// ```
12921311 #[ rustc_const_stable( feature = "const_ipv6" , since = "1.50.0" ) ]
12931312 #[ stable( since = "1.7.0" , feature = "ip_17" ) ]
1313+ #[ must_use]
12941314 #[ inline]
12951315 pub const fn is_unspecified ( & self ) -> bool {
12961316 u128:: from_be_bytes ( self . octets ( ) ) == u128:: from_be_bytes ( Ipv6Addr :: UNSPECIFIED . octets ( ) )
@@ -1314,6 +1334,7 @@ impl Ipv6Addr {
13141334 /// ```
13151335 #[ rustc_const_stable( feature = "const_ipv6" , since = "1.50.0" ) ]
13161336 #[ stable( since = "1.7.0" , feature = "ip_17" ) ]
1337+ #[ must_use]
13171338 #[ inline]
13181339 pub const fn is_loopback ( & self ) -> bool {
13191340 u128:: from_be_bytes ( self . octets ( ) ) == u128:: from_be_bytes ( Ipv6Addr :: LOCALHOST . octets ( ) )
@@ -1340,6 +1361,7 @@ impl Ipv6Addr {
13401361 /// ```
13411362 #[ rustc_const_unstable( feature = "const_ipv6" , issue = "76205" ) ]
13421363 #[ unstable( feature = "ip" , issue = "27709" ) ]
1364+ #[ must_use]
13431365 #[ inline]
13441366 pub const fn is_global ( & self ) -> bool {
13451367 match self . multicast_scope ( ) {
@@ -1367,6 +1389,7 @@ impl Ipv6Addr {
13671389 /// ```
13681390 #[ rustc_const_unstable( feature = "const_ipv6" , issue = "76205" ) ]
13691391 #[ unstable( feature = "ip" , issue = "27709" ) ]
1392+ #[ must_use]
13701393 #[ inline]
13711394 pub const fn is_unique_local ( & self ) -> bool {
13721395 ( self . segments ( ) [ 0 ] & 0xfe00 ) == 0xfc00
@@ -1395,6 +1418,7 @@ impl Ipv6Addr {
13951418 /// ```
13961419 #[ rustc_const_unstable( feature = "const_ipv6" , issue = "76205" ) ]
13971420 #[ unstable( feature = "ip" , issue = "27709" ) ]
1421+ #[ must_use]
13981422 #[ inline]
13991423 pub const fn is_unicast ( & self ) -> bool {
14001424 !self . is_multicast ( )
@@ -1446,6 +1470,7 @@ impl Ipv6Addr {
14461470 /// ```
14471471 #[ rustc_const_unstable( feature = "const_ipv6" , issue = "76205" ) ]
14481472 #[ unstable( feature = "ip" , issue = "27709" ) ]
1473+ #[ must_use]
14491474 #[ inline]
14501475 pub const fn is_unicast_link_local ( & self ) -> bool {
14511476 ( self . segments ( ) [ 0 ] & 0xffc0 ) == 0xfe80
@@ -1470,6 +1495,7 @@ impl Ipv6Addr {
14701495 /// ```
14711496 #[ rustc_const_unstable( feature = "const_ipv6" , issue = "76205" ) ]
14721497 #[ unstable( feature = "ip" , issue = "27709" ) ]
1498+ #[ must_use]
14731499 #[ inline]
14741500 pub const fn is_documentation ( & self ) -> bool {
14751501 ( self . segments ( ) [ 0 ] == 0x2001 ) && ( self . segments ( ) [ 1 ] == 0xdb8 )
@@ -1492,6 +1518,7 @@ impl Ipv6Addr {
14921518 /// assert_eq!(Ipv6Addr::new(0x2001, 0x2, 0, 0, 0, 0, 0, 0).is_benchmarking(), true);
14931519 /// ```
14941520 #[ unstable( feature = "ip" , issue = "27709" ) ]
1521+ #[ must_use]
14951522 #[ inline]
14961523 pub const fn is_benchmarking ( & self ) -> bool {
14971524 ( self . segments ( ) [ 0 ] == 0x2001 ) && ( self . segments ( ) [ 1 ] == 0x2 ) && ( self . segments ( ) [ 2 ] == 0 )
@@ -1529,6 +1556,7 @@ impl Ipv6Addr {
15291556 /// ```
15301557 #[ rustc_const_unstable( feature = "const_ipv6" , issue = "76205" ) ]
15311558 #[ unstable( feature = "ip" , issue = "27709" ) ]
1559+ #[ must_use]
15321560 #[ inline]
15331561 pub const fn is_unicast_global ( & self ) -> bool {
15341562 self . is_unicast ( )
@@ -1590,6 +1618,7 @@ impl Ipv6Addr {
15901618 /// ```
15911619 #[ rustc_const_stable( feature = "const_ipv6" , since = "1.50.0" ) ]
15921620 #[ stable( since = "1.7.0" , feature = "ip_17" ) ]
1621+ #[ must_use]
15931622 #[ inline]
15941623 pub const fn is_multicast ( & self ) -> bool {
15951624 ( self . segments ( ) [ 0 ] & 0xff00 ) == 0xff00
0 commit comments