@@ -377,6 +377,8 @@ impl char {
377
377
/// ```
378
378
/// assert_eq!('❤'.escape_unicode().to_string(), "\\u{2764}");
379
379
/// ```
380
+ #[ must_use = "this returns the escaped char as an iterator, \
381
+ without modifying the original"]
380
382
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
381
383
#[ inline]
382
384
pub fn escape_unicode ( self ) -> EscapeUnicode {
@@ -453,6 +455,8 @@ impl char {
453
455
/// ```
454
456
/// assert_eq!('\n'.escape_debug().to_string(), "\\n");
455
457
/// ```
458
+ #[ must_use = "this returns the escaped char as an iterator, \
459
+ without modifying the original"]
456
460
#[ stable( feature = "char_escape_debug" , since = "1.20.0" ) ]
457
461
#[ inline]
458
462
pub fn escape_debug ( self ) -> EscapeDebug {
@@ -507,6 +511,8 @@ impl char {
507
511
/// ```
508
512
/// assert_eq!('"'.escape_default().to_string(), "\\\"");
509
513
/// ```
514
+ #[ must_use = "this returns the escaped char as an iterator, \
515
+ without modifying the original"]
510
516
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
511
517
#[ inline]
512
518
pub fn escape_default ( self ) -> EscapeDefault {
@@ -692,6 +698,7 @@ impl char {
692
698
/// // love is many things, but it is not alphabetic
693
699
/// assert!(!c.is_alphabetic());
694
700
/// ```
701
+ #[ must_use]
695
702
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
696
703
#[ inline]
697
704
pub fn is_alphabetic ( self ) -> bool {
@@ -724,6 +731,7 @@ impl char {
724
731
/// assert!(!'中'.is_lowercase());
725
732
/// assert!(!' '.is_lowercase());
726
733
/// ```
734
+ #[ must_use]
727
735
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
728
736
#[ inline]
729
737
pub fn is_lowercase ( self ) -> bool {
@@ -756,6 +764,7 @@ impl char {
756
764
/// assert!(!'中'.is_uppercase());
757
765
/// assert!(!' '.is_uppercase());
758
766
/// ```
767
+ #[ must_use]
759
768
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
760
769
#[ inline]
761
770
pub fn is_uppercase ( self ) -> bool {
@@ -784,6 +793,7 @@ impl char {
784
793
///
785
794
/// assert!(!'越'.is_whitespace());
786
795
/// ```
796
+ #[ must_use]
787
797
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
788
798
#[ inline]
789
799
pub fn is_whitespace ( self ) -> bool {
@@ -812,6 +822,7 @@ impl char {
812
822
/// assert!('و'.is_alphanumeric());
813
823
/// assert!('藏'.is_alphanumeric());
814
824
/// ```
825
+ #[ must_use]
815
826
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
816
827
#[ inline]
817
828
pub fn is_alphanumeric ( self ) -> bool {
@@ -837,6 +848,7 @@ impl char {
837
848
/// assert!(''.is_control());
838
849
/// assert!(!'q'.is_control());
839
850
/// ```
851
+ #[ must_use]
840
852
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
841
853
#[ inline]
842
854
pub fn is_control ( self ) -> bool {
@@ -852,6 +864,7 @@ impl char {
852
864
/// [uax29]: https://www.unicode.org/reports/tr29/
853
865
/// [ucd]: https://www.unicode.org/reports/tr44/
854
866
/// [`DerivedCoreProperties.txt`]: https://www.unicode.org/Public/UCD/latest/ucd/DerivedCoreProperties.txt
867
+ #[ must_use]
855
868
#[ inline]
856
869
pub ( crate ) fn is_grapheme_extended ( self ) -> bool {
857
870
unicode:: Grapheme_Extend ( self )
@@ -881,6 +894,7 @@ impl char {
881
894
/// assert!(!'و'.is_numeric());
882
895
/// assert!(!'藏'.is_numeric());
883
896
/// ```
897
+ #[ must_use]
884
898
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
885
899
#[ inline]
886
900
pub fn is_numeric ( self ) -> bool {
@@ -1060,6 +1074,7 @@ impl char {
1060
1074
/// assert!(ascii.is_ascii());
1061
1075
/// assert!(!non_ascii.is_ascii());
1062
1076
/// ```
1077
+ #[ must_use]
1063
1078
#[ stable( feature = "ascii_methods_on_intrinsics" , since = "1.23.0" ) ]
1064
1079
#[ rustc_const_stable( feature = "const_ascii_methods_on_intrinsics" , since = "1.32.0" ) ]
1065
1080
#[ inline]
@@ -1237,6 +1252,7 @@ impl char {
1237
1252
/// assert!(!lf.is_ascii_alphabetic());
1238
1253
/// assert!(!esc.is_ascii_alphabetic());
1239
1254
/// ```
1255
+ #[ must_use]
1240
1256
#[ stable( feature = "ascii_ctype_on_intrinsics" , since = "1.24.0" ) ]
1241
1257
#[ rustc_const_stable( feature = "const_ascii_ctype_on_intrinsics" , since = "1.47.0" ) ]
1242
1258
#[ inline]
@@ -1270,6 +1286,7 @@ impl char {
1270
1286
/// assert!(!lf.is_ascii_uppercase());
1271
1287
/// assert!(!esc.is_ascii_uppercase());
1272
1288
/// ```
1289
+ #[ must_use]
1273
1290
#[ stable( feature = "ascii_ctype_on_intrinsics" , since = "1.24.0" ) ]
1274
1291
#[ rustc_const_stable( feature = "const_ascii_ctype_on_intrinsics" , since = "1.47.0" ) ]
1275
1292
#[ inline]
@@ -1303,6 +1320,7 @@ impl char {
1303
1320
/// assert!(!lf.is_ascii_lowercase());
1304
1321
/// assert!(!esc.is_ascii_lowercase());
1305
1322
/// ```
1323
+ #[ must_use]
1306
1324
#[ stable( feature = "ascii_ctype_on_intrinsics" , since = "1.24.0" ) ]
1307
1325
#[ rustc_const_stable( feature = "const_ascii_ctype_on_intrinsics" , since = "1.47.0" ) ]
1308
1326
#[ inline]
@@ -1339,6 +1357,7 @@ impl char {
1339
1357
/// assert!(!lf.is_ascii_alphanumeric());
1340
1358
/// assert!(!esc.is_ascii_alphanumeric());
1341
1359
/// ```
1360
+ #[ must_use]
1342
1361
#[ stable( feature = "ascii_ctype_on_intrinsics" , since = "1.24.0" ) ]
1343
1362
#[ rustc_const_stable( feature = "const_ascii_ctype_on_intrinsics" , since = "1.47.0" ) ]
1344
1363
#[ inline]
@@ -1372,6 +1391,7 @@ impl char {
1372
1391
/// assert!(!lf.is_ascii_digit());
1373
1392
/// assert!(!esc.is_ascii_digit());
1374
1393
/// ```
1394
+ #[ must_use]
1375
1395
#[ stable( feature = "ascii_ctype_on_intrinsics" , since = "1.24.0" ) ]
1376
1396
#[ rustc_const_stable( feature = "const_ascii_ctype_on_intrinsics" , since = "1.47.0" ) ]
1377
1397
#[ inline]
@@ -1408,6 +1428,7 @@ impl char {
1408
1428
/// assert!(!lf.is_ascii_hexdigit());
1409
1429
/// assert!(!esc.is_ascii_hexdigit());
1410
1430
/// ```
1431
+ #[ must_use]
1411
1432
#[ stable( feature = "ascii_ctype_on_intrinsics" , since = "1.24.0" ) ]
1412
1433
#[ rustc_const_stable( feature = "const_ascii_ctype_on_intrinsics" , since = "1.47.0" ) ]
1413
1434
#[ inline]
@@ -1445,6 +1466,7 @@ impl char {
1445
1466
/// assert!(!lf.is_ascii_punctuation());
1446
1467
/// assert!(!esc.is_ascii_punctuation());
1447
1468
/// ```
1469
+ #[ must_use]
1448
1470
#[ stable( feature = "ascii_ctype_on_intrinsics" , since = "1.24.0" ) ]
1449
1471
#[ rustc_const_stable( feature = "const_ascii_ctype_on_intrinsics" , since = "1.47.0" ) ]
1450
1472
#[ inline]
@@ -1478,6 +1500,7 @@ impl char {
1478
1500
/// assert!(!lf.is_ascii_graphic());
1479
1501
/// assert!(!esc.is_ascii_graphic());
1480
1502
/// ```
1503
+ #[ must_use]
1481
1504
#[ stable( feature = "ascii_ctype_on_intrinsics" , since = "1.24.0" ) ]
1482
1505
#[ rustc_const_stable( feature = "const_ascii_ctype_on_intrinsics" , since = "1.47.0" ) ]
1483
1506
#[ inline]
@@ -1528,6 +1551,7 @@ impl char {
1528
1551
/// assert!(lf.is_ascii_whitespace());
1529
1552
/// assert!(!esc.is_ascii_whitespace());
1530
1553
/// ```
1554
+ #[ must_use]
1531
1555
#[ stable( feature = "ascii_ctype_on_intrinsics" , since = "1.24.0" ) ]
1532
1556
#[ rustc_const_stable( feature = "const_ascii_ctype_on_intrinsics" , since = "1.47.0" ) ]
1533
1557
#[ inline]
@@ -1563,6 +1587,7 @@ impl char {
1563
1587
/// assert!(lf.is_ascii_control());
1564
1588
/// assert!(esc.is_ascii_control());
1565
1589
/// ```
1590
+ #[ must_use]
1566
1591
#[ stable( feature = "ascii_ctype_on_intrinsics" , since = "1.24.0" ) ]
1567
1592
#[ rustc_const_stable( feature = "const_ascii_ctype_on_intrinsics" , since = "1.47.0" ) ]
1568
1593
#[ inline]
0 commit comments