@@ -233,6 +233,7 @@ impl IpAddr {
233
233
/// ```
234
234
#[ rustc_const_stable( feature = "const_ip" , since = "1.50.0" ) ]
235
235
#[ stable( feature = "ip_shared" , since = "1.12.0" ) ]
236
+ #[ must_use]
236
237
#[ inline]
237
238
pub const fn is_unspecified ( & self ) -> bool {
238
239
match self {
@@ -256,6 +257,7 @@ impl IpAddr {
256
257
/// ```
257
258
#[ rustc_const_stable( feature = "const_ip" , since = "1.50.0" ) ]
258
259
#[ stable( feature = "ip_shared" , since = "1.12.0" ) ]
260
+ #[ must_use]
259
261
#[ inline]
260
262
pub const fn is_loopback ( & self ) -> bool {
261
263
match self {
@@ -281,6 +283,7 @@ impl IpAddr {
281
283
/// ```
282
284
#[ rustc_const_unstable( feature = "const_ip" , issue = "76205" ) ]
283
285
#[ unstable( feature = "ip" , issue = "27709" ) ]
286
+ #[ must_use]
284
287
#[ inline]
285
288
pub const fn is_global ( & self ) -> bool {
286
289
match self {
@@ -304,6 +307,7 @@ impl IpAddr {
304
307
/// ```
305
308
#[ rustc_const_stable( feature = "const_ip" , since = "1.50.0" ) ]
306
309
#[ stable( feature = "ip_shared" , since = "1.12.0" ) ]
310
+ #[ must_use]
307
311
#[ inline]
308
312
pub const fn is_multicast ( & self ) -> bool {
309
313
match self {
@@ -332,6 +336,7 @@ impl IpAddr {
332
336
/// ```
333
337
#[ rustc_const_unstable( feature = "const_ip" , issue = "76205" ) ]
334
338
#[ unstable( feature = "ip" , issue = "27709" ) ]
339
+ #[ must_use]
335
340
#[ inline]
336
341
pub const fn is_documentation ( & self ) -> bool {
337
342
match self {
@@ -356,6 +361,7 @@ impl IpAddr {
356
361
/// assert_eq!(IpAddr::V6(Ipv6Addr::new(0x2001, 0x2, 0, 0, 0, 0, 0, 0)).is_benchmarking(), true);
357
362
/// ```
358
363
#[ unstable( feature = "ip" , issue = "27709" ) ]
364
+ #[ must_use]
359
365
#[ inline]
360
366
pub const fn is_benchmarking ( & self ) -> bool {
361
367
match self {
@@ -379,6 +385,7 @@ impl IpAddr {
379
385
/// ```
380
386
#[ rustc_const_stable( feature = "const_ip" , since = "1.50.0" ) ]
381
387
#[ stable( feature = "ipaddr_checker" , since = "1.16.0" ) ]
388
+ #[ must_use]
382
389
#[ inline]
383
390
pub const fn is_ipv4 ( & self ) -> bool {
384
391
matches ! ( self , IpAddr :: V4 ( _) )
@@ -399,6 +406,7 @@ impl IpAddr {
399
406
/// ```
400
407
#[ rustc_const_stable( feature = "const_ip" , since = "1.50.0" ) ]
401
408
#[ stable( feature = "ipaddr_checker" , since = "1.16.0" ) ]
409
+ #[ must_use]
402
410
#[ inline]
403
411
pub const fn is_ipv6 ( & self ) -> bool {
404
412
matches ! ( self , IpAddr :: V6 ( _) )
@@ -527,6 +535,7 @@ impl Ipv4Addr {
527
535
/// ```
528
536
#[ rustc_const_stable( feature = "const_ipv4" , since = "1.32.0" ) ]
529
537
#[ stable( feature = "ip_shared" , since = "1.12.0" ) ]
538
+ #[ must_use]
530
539
#[ inline]
531
540
pub const fn is_unspecified ( & self ) -> bool {
532
541
self . inner . s_addr == 0
@@ -548,6 +557,7 @@ impl Ipv4Addr {
548
557
/// ```
549
558
#[ rustc_const_stable( feature = "const_ipv4" , since = "1.50.0" ) ]
550
559
#[ stable( since = "1.7.0" , feature = "ip_17" ) ]
560
+ #[ must_use]
551
561
#[ inline]
552
562
pub const fn is_loopback ( & self ) -> bool {
553
563
self . octets ( ) [ 0 ] == 127
@@ -578,6 +588,7 @@ impl Ipv4Addr {
578
588
/// ```
579
589
#[ rustc_const_stable( feature = "const_ipv4" , since = "1.50.0" ) ]
580
590
#[ stable( since = "1.7.0" , feature = "ip_17" ) ]
591
+ #[ must_use]
581
592
#[ inline]
582
593
pub const fn is_private ( & self ) -> bool {
583
594
match self . octets ( ) {
@@ -605,6 +616,7 @@ impl Ipv4Addr {
605
616
/// ```
606
617
#[ rustc_const_stable( feature = "const_ipv4" , since = "1.50.0" ) ]
607
618
#[ stable( since = "1.7.0" , feature = "ip_17" ) ]
619
+ #[ must_use]
608
620
#[ inline]
609
621
pub const fn is_link_local ( & self ) -> bool {
610
622
matches ! ( self . octets( ) , [ 169 , 254 , ..] )
@@ -680,6 +692,7 @@ impl Ipv4Addr {
680
692
/// ```
681
693
#[ rustc_const_unstable( feature = "const_ipv4" , issue = "76205" ) ]
682
694
#[ unstable( feature = "ip" , issue = "27709" ) ]
695
+ #[ must_use]
683
696
#[ inline]
684
697
pub const fn is_global ( & self ) -> bool {
685
698
// 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 {
720
733
/// ```
721
734
#[ rustc_const_unstable( feature = "const_ipv4" , issue = "76205" ) ]
722
735
#[ unstable( feature = "ip" , issue = "27709" ) ]
736
+ #[ must_use]
723
737
#[ inline]
724
738
pub const fn is_shared ( & self ) -> bool {
725
739
self . octets ( ) [ 0 ] == 100 && ( self . octets ( ) [ 1 ] & 0b1100_0000 == 0b0100_0000 )
@@ -745,6 +759,7 @@ impl Ipv4Addr {
745
759
/// ```
746
760
#[ rustc_const_unstable( feature = "const_ipv4" , issue = "76205" ) ]
747
761
#[ unstable( feature = "ip" , issue = "27709" ) ]
762
+ #[ must_use]
748
763
#[ inline]
749
764
pub const fn is_benchmarking ( & self ) -> bool {
750
765
self . octets ( ) [ 0 ] == 198 && ( self . octets ( ) [ 1 ] & 0xfe ) == 18
@@ -779,6 +794,7 @@ impl Ipv4Addr {
779
794
/// ```
780
795
#[ rustc_const_unstable( feature = "const_ipv4" , issue = "76205" ) ]
781
796
#[ unstable( feature = "ip" , issue = "27709" ) ]
797
+ #[ must_use]
782
798
#[ inline]
783
799
pub const fn is_reserved ( & self ) -> bool {
784
800
self . octets ( ) [ 0 ] & 240 == 240 && !self . is_broadcast ( )
@@ -802,6 +818,7 @@ impl Ipv4Addr {
802
818
/// ```
803
819
#[ rustc_const_stable( feature = "const_ipv4" , since = "1.50.0" ) ]
804
820
#[ stable( since = "1.7.0" , feature = "ip_17" ) ]
821
+ #[ must_use]
805
822
#[ inline]
806
823
pub const fn is_multicast ( & self ) -> bool {
807
824
self . octets ( ) [ 0 ] >= 224 && self . octets ( ) [ 0 ] <= 239
@@ -823,6 +840,7 @@ impl Ipv4Addr {
823
840
/// ```
824
841
#[ rustc_const_stable( feature = "const_ipv4" , since = "1.50.0" ) ]
825
842
#[ stable( since = "1.7.0" , feature = "ip_17" ) ]
843
+ #[ must_use]
826
844
#[ inline]
827
845
pub const fn is_broadcast ( & self ) -> bool {
828
846
u32:: from_be_bytes ( self . octets ( ) ) == u32:: from_be_bytes ( Self :: BROADCAST . octets ( ) )
@@ -850,6 +868,7 @@ impl Ipv4Addr {
850
868
/// ```
851
869
#[ rustc_const_stable( feature = "const_ipv4" , since = "1.50.0" ) ]
852
870
#[ stable( since = "1.7.0" , feature = "ip_17" ) ]
871
+ #[ must_use]
853
872
#[ inline]
854
873
pub const fn is_documentation ( & self ) -> bool {
855
874
match self . octets ( ) {
@@ -1291,6 +1310,7 @@ impl Ipv6Addr {
1291
1310
/// ```
1292
1311
#[ rustc_const_stable( feature = "const_ipv6" , since = "1.50.0" ) ]
1293
1312
#[ stable( since = "1.7.0" , feature = "ip_17" ) ]
1313
+ #[ must_use]
1294
1314
#[ inline]
1295
1315
pub const fn is_unspecified ( & self ) -> bool {
1296
1316
u128:: from_be_bytes ( self . octets ( ) ) == u128:: from_be_bytes ( Ipv6Addr :: UNSPECIFIED . octets ( ) )
@@ -1314,6 +1334,7 @@ impl Ipv6Addr {
1314
1334
/// ```
1315
1335
#[ rustc_const_stable( feature = "const_ipv6" , since = "1.50.0" ) ]
1316
1336
#[ stable( since = "1.7.0" , feature = "ip_17" ) ]
1337
+ #[ must_use]
1317
1338
#[ inline]
1318
1339
pub const fn is_loopback ( & self ) -> bool {
1319
1340
u128:: from_be_bytes ( self . octets ( ) ) == u128:: from_be_bytes ( Ipv6Addr :: LOCALHOST . octets ( ) )
@@ -1340,6 +1361,7 @@ impl Ipv6Addr {
1340
1361
/// ```
1341
1362
#[ rustc_const_unstable( feature = "const_ipv6" , issue = "76205" ) ]
1342
1363
#[ unstable( feature = "ip" , issue = "27709" ) ]
1364
+ #[ must_use]
1343
1365
#[ inline]
1344
1366
pub const fn is_global ( & self ) -> bool {
1345
1367
match self . multicast_scope ( ) {
@@ -1367,6 +1389,7 @@ impl Ipv6Addr {
1367
1389
/// ```
1368
1390
#[ rustc_const_unstable( feature = "const_ipv6" , issue = "76205" ) ]
1369
1391
#[ unstable( feature = "ip" , issue = "27709" ) ]
1392
+ #[ must_use]
1370
1393
#[ inline]
1371
1394
pub const fn is_unique_local ( & self ) -> bool {
1372
1395
( self . segments ( ) [ 0 ] & 0xfe00 ) == 0xfc00
@@ -1395,6 +1418,7 @@ impl Ipv6Addr {
1395
1418
/// ```
1396
1419
#[ rustc_const_unstable( feature = "const_ipv6" , issue = "76205" ) ]
1397
1420
#[ unstable( feature = "ip" , issue = "27709" ) ]
1421
+ #[ must_use]
1398
1422
#[ inline]
1399
1423
pub const fn is_unicast ( & self ) -> bool {
1400
1424
!self . is_multicast ( )
@@ -1446,6 +1470,7 @@ impl Ipv6Addr {
1446
1470
/// ```
1447
1471
#[ rustc_const_unstable( feature = "const_ipv6" , issue = "76205" ) ]
1448
1472
#[ unstable( feature = "ip" , issue = "27709" ) ]
1473
+ #[ must_use]
1449
1474
#[ inline]
1450
1475
pub const fn is_unicast_link_local ( & self ) -> bool {
1451
1476
( self . segments ( ) [ 0 ] & 0xffc0 ) == 0xfe80
@@ -1470,6 +1495,7 @@ impl Ipv6Addr {
1470
1495
/// ```
1471
1496
#[ rustc_const_unstable( feature = "const_ipv6" , issue = "76205" ) ]
1472
1497
#[ unstable( feature = "ip" , issue = "27709" ) ]
1498
+ #[ must_use]
1473
1499
#[ inline]
1474
1500
pub const fn is_documentation ( & self ) -> bool {
1475
1501
( self . segments ( ) [ 0 ] == 0x2001 ) && ( self . segments ( ) [ 1 ] == 0xdb8 )
@@ -1492,6 +1518,7 @@ impl Ipv6Addr {
1492
1518
/// assert_eq!(Ipv6Addr::new(0x2001, 0x2, 0, 0, 0, 0, 0, 0).is_benchmarking(), true);
1493
1519
/// ```
1494
1520
#[ unstable( feature = "ip" , issue = "27709" ) ]
1521
+ #[ must_use]
1495
1522
#[ inline]
1496
1523
pub const fn is_benchmarking ( & self ) -> bool {
1497
1524
( self . segments ( ) [ 0 ] == 0x2001 ) && ( self . segments ( ) [ 1 ] == 0x2 ) && ( self . segments ( ) [ 2 ] == 0 )
@@ -1529,6 +1556,7 @@ impl Ipv6Addr {
1529
1556
/// ```
1530
1557
#[ rustc_const_unstable( feature = "const_ipv6" , issue = "76205" ) ]
1531
1558
#[ unstable( feature = "ip" , issue = "27709" ) ]
1559
+ #[ must_use]
1532
1560
#[ inline]
1533
1561
pub const fn is_unicast_global ( & self ) -> bool {
1534
1562
self . is_unicast ( )
@@ -1590,6 +1618,7 @@ impl Ipv6Addr {
1590
1618
/// ```
1591
1619
#[ rustc_const_stable( feature = "const_ipv6" , since = "1.50.0" ) ]
1592
1620
#[ stable( since = "1.7.0" , feature = "ip_17" ) ]
1621
+ #[ must_use]
1593
1622
#[ inline]
1594
1623
pub const fn is_multicast ( & self ) -> bool {
1595
1624
( self . segments ( ) [ 0 ] & 0xff00 ) == 0xff00
0 commit comments