@@ -49,7 +49,9 @@ pub struct ToLowercase(CaseMappingIter);
49
49
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
50
50
impl Iterator for ToLowercase {
51
51
type Item = char ;
52
- fn next ( & mut self ) -> Option < char > { self . 0 . next ( ) }
52
+ fn next ( & mut self ) -> Option < char > {
53
+ self . 0 . next ( )
54
+ }
53
55
}
54
56
55
57
/// An iterator over the uppercase mapping of a given character, returned from
@@ -61,15 +63,17 @@ pub struct ToUppercase(CaseMappingIter);
61
63
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
62
64
impl Iterator for ToUppercase {
63
65
type Item = char ;
64
- fn next ( & mut self ) -> Option < char > { self . 0 . next ( ) }
66
+ fn next ( & mut self ) -> Option < char > {
67
+ self . 0 . next ( )
68
+ }
65
69
}
66
70
67
71
68
72
enum CaseMappingIter {
69
73
Three ( char , char , char ) ,
70
74
Two ( char , char ) ,
71
75
One ( char ) ,
72
- Zero
76
+ Zero ,
73
77
}
74
78
75
79
impl CaseMappingIter {
@@ -165,7 +169,9 @@ impl char {
165
169
/// ```
166
170
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
167
171
#[ inline]
168
- pub fn is_digit ( self , radix : u32 ) -> bool { C :: is_digit ( self , radix) }
172
+ pub fn is_digit ( self , radix : u32 ) -> bool {
173
+ C :: is_digit ( self , radix)
174
+ }
169
175
170
176
/// Converts a `char` to a digit in the given radix.
171
177
///
@@ -229,7 +235,9 @@ impl char {
229
235
/// ```
230
236
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
231
237
#[ inline]
232
- pub fn to_digit ( self , radix : u32 ) -> Option < u32 > { C :: to_digit ( self , radix) }
238
+ pub fn to_digit ( self , radix : u32 ) -> Option < u32 > {
239
+ C :: to_digit ( self , radix)
240
+ }
233
241
234
242
/// Returns an iterator that yields the hexadecimal Unicode escape of a
235
243
/// character, as `char`s.
@@ -262,7 +270,9 @@ impl char {
262
270
/// ```
263
271
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
264
272
#[ inline]
265
- pub fn escape_unicode ( self ) -> EscapeUnicode { C :: escape_unicode ( self ) }
273
+ pub fn escape_unicode ( self ) -> EscapeUnicode {
274
+ C :: escape_unicode ( self )
275
+ }
266
276
267
277
/// Returns an iterator that yields the literal escape code of a `char`.
268
278
///
@@ -309,7 +319,9 @@ impl char {
309
319
/// ```
310
320
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
311
321
#[ inline]
312
- pub fn escape_default ( self ) -> EscapeDefault { C :: escape_default ( self ) }
322
+ pub fn escape_default ( self ) -> EscapeDefault {
323
+ C :: escape_default ( self )
324
+ }
313
325
314
326
/// Returns the number of bytes this `char` would need if encoded in UTF-8.
315
327
///
@@ -358,7 +370,9 @@ impl char {
358
370
/// ```
359
371
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
360
372
#[ inline]
361
- pub fn len_utf8 ( self ) -> usize { C :: len_utf8 ( self ) }
373
+ pub fn len_utf8 ( self ) -> usize {
374
+ C :: len_utf8 ( self )
375
+ }
362
376
363
377
/// Returns the number of 16-bit code units this `char` would need if
364
378
/// encoded in UTF-16.
@@ -378,7 +392,9 @@ impl char {
378
392
/// ```
379
393
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
380
394
#[ inline]
381
- pub fn len_utf16 ( self ) -> usize { C :: len_utf16 ( self ) }
395
+ pub fn len_utf16 ( self ) -> usize {
396
+ C :: len_utf16 ( self )
397
+ }
382
398
383
399
/// Encodes this character as UTF-8 into the provided byte buffer, and then
384
400
/// returns the number of bytes written.
@@ -482,9 +498,9 @@ impl char {
482
498
#[ inline]
483
499
pub fn is_alphabetic ( self ) -> bool {
484
500
match self {
485
- 'a' ... 'z' | 'A' ... 'Z' => true ,
501
+ 'a' ...'z' | 'A' ...'Z' => true ,
486
502
c if c > '\x7f' => derived_property:: Alphabetic ( c) ,
487
- _ => false
503
+ _ => false ,
488
504
}
489
505
}
490
506
@@ -498,7 +514,9 @@ impl char {
498
514
reason = "mainly needed for compiler internals" ,
499
515
issue = "0" ) ]
500
516
#[ inline]
501
- pub fn is_xid_start ( self ) -> bool { derived_property:: XID_Start ( self ) }
517
+ pub fn is_xid_start ( self ) -> bool {
518
+ derived_property:: XID_Start ( self )
519
+ }
502
520
503
521
/// Returns true if this `char` satisfies the 'XID_Continue' Unicode property, and false
504
522
/// otherwise.
@@ -510,7 +528,9 @@ impl char {
510
528
reason = "mainly needed for compiler internals" ,
511
529
issue = "0" ) ]
512
530
#[ inline]
513
- pub fn is_xid_continue ( self ) -> bool { derived_property:: XID_Continue ( self ) }
531
+ pub fn is_xid_continue ( self ) -> bool {
532
+ derived_property:: XID_Continue ( self )
533
+ }
514
534
515
535
/// Returns true if this `char` is lowercase, and false otherwise.
516
536
///
@@ -542,9 +562,9 @@ impl char {
542
562
#[ inline]
543
563
pub fn is_lowercase ( self ) -> bool {
544
564
match self {
545
- 'a' ... 'z' => true ,
565
+ 'a' ...'z' => true ,
546
566
c if c > '\x7f' => derived_property:: Lowercase ( c) ,
547
- _ => false
567
+ _ => false ,
548
568
}
549
569
}
550
570
@@ -578,9 +598,9 @@ impl char {
578
598
#[ inline]
579
599
pub fn is_uppercase ( self ) -> bool {
580
600
match self {
581
- 'A' ... 'Z' => true ,
601
+ 'A' ...'Z' => true ,
582
602
c if c > '\x7f' => derived_property:: Uppercase ( c) ,
583
- _ => false
603
+ _ => false ,
584
604
}
585
605
}
586
606
@@ -608,9 +628,9 @@ impl char {
608
628
#[ inline]
609
629
pub fn is_whitespace ( self ) -> bool {
610
630
match self {
611
- ' ' | '\x09' ... '\x0d' => true ,
631
+ ' ' | '\x09' ...'\x0d' => true ,
612
632
c if c > '\x7f' => property:: White_Space ( c) ,
613
- _ => false
633
+ _ => false ,
614
634
}
615
635
}
616
636
@@ -673,7 +693,9 @@ impl char {
673
693
/// ```
674
694
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
675
695
#[ inline]
676
- pub fn is_control ( self ) -> bool { general_category:: Cc ( self ) }
696
+ pub fn is_control ( self ) -> bool {
697
+ general_category:: Cc ( self )
698
+ }
677
699
678
700
/// Returns true if this `char` is numeric, and false otherwise.
679
701
///
@@ -713,9 +735,9 @@ impl char {
713
735
#[ inline]
714
736
pub fn is_numeric ( self ) -> bool {
715
737
match self {
716
- '0' ... '9' => true ,
738
+ '0' ...'9' => true ,
717
739
c if c > '\x7f' => general_category:: N ( c) ,
718
- _ => false
740
+ _ => false ,
719
741
}
720
742
}
721
743
@@ -823,7 +845,9 @@ impl char {
823
845
/// An iterator that decodes UTF-16 encoded code points from an iterator of `u16`s.
824
846
#[ unstable( feature = "decode_utf16" , reason = "recently exposed" , issue = "27830" ) ]
825
847
#[ derive( Clone ) ]
826
- pub struct DecodeUtf16 < I > where I : Iterator < Item =u16 > {
848
+ pub struct DecodeUtf16 < I >
849
+ where I : Iterator < Item = u16 >
850
+ {
827
851
iter : I ,
828
852
buf : Option < u16 > ,
829
853
}
@@ -874,7 +898,7 @@ pub struct DecodeUtf16<I> where I: Iterator<Item=u16> {
874
898
/// ```
875
899
#[ unstable( feature = "decode_utf16" , reason = "recently exposed" , issue = "27830" ) ]
876
900
#[ inline]
877
- pub fn decode_utf16 < I : IntoIterator < Item = u16 > > ( iterable : I ) -> DecodeUtf16 < I :: IntoIter > {
901
+ pub fn decode_utf16 < I : IntoIterator < Item = u16 > > ( iterable : I ) -> DecodeUtf16 < I :: IntoIter > {
878
902
DecodeUtf16 {
879
903
iter : iterable. into_iter ( ) ,
880
904
buf : None ,
@@ -890,8 +914,8 @@ impl<I: Iterator<Item=u16>> Iterator for DecodeUtf16<I> {
890
914
Some ( buf) => buf,
891
915
None => match self . iter . next ( ) {
892
916
Some ( u) => u,
893
- None => return None
894
- }
917
+ None => return None ,
918
+ } ,
895
919
} ;
896
920
897
921
if u < 0xD800 || 0xDFFF < u {
@@ -904,13 +928,13 @@ impl<I: Iterator<Item=u16>> Iterator for DecodeUtf16<I> {
904
928
let u2 = match self . iter . next ( ) {
905
929
Some ( u2) => u2,
906
930
// eof
907
- None => return Some ( Err ( u) )
931
+ None => return Some ( Err ( u) ) ,
908
932
} ;
909
933
if u2 < 0xDC00 || u2 > 0xDFFF {
910
934
// not a trailing surrogate so we're not a valid
911
935
// surrogate pair, so rewind to redecode u2 next time.
912
936
self . buf = Some ( u2) ;
913
- return Some ( Err ( u) )
937
+ return Some ( Err ( u) ) ;
914
938
}
915
939
916
940
// all ok, so lets decode it.
0 commit comments