Skip to content

Commit 2c48214

Browse files
committed
doc: remove needless bindings
1 parent 235d774 commit 2c48214

File tree

1 file changed

+48
-132
lines changed

1 file changed

+48
-132
lines changed

src/librustc_unicode/char.rs

+48-132
Original file line numberDiff line numberDiff line change
@@ -151,14 +151,9 @@ impl char {
151151
/// Basic usage:
152152
///
153153
/// ```
154-
/// let d = '1';
155-
///
156-
/// assert!(d.is_digit(10));
157-
///
158-
/// let d = 'f';
159-
///
160-
/// assert!(d.is_digit(16));
161-
/// assert!(!d.is_digit(10));
154+
/// assert!('1'.is_digit(10));
155+
/// assert!('f'.is_digit(16));
156+
/// assert!(!'f'.is_digit(10));
162157
/// ```
163158
///
164159
/// Passing a large radix, causing a panic:
@@ -167,10 +162,8 @@ impl char {
167162
/// use std::thread;
168163
///
169164
/// let result = thread::spawn(|| {
170-
/// let d = '1';
171-
///
172165
/// // this panics
173-
/// d.is_digit(37);
166+
/// '1'.is_digit(37);
174167
/// }).join();
175168
///
176169
/// assert!(result.is_err());
@@ -207,25 +200,15 @@ impl char {
207200
/// Basic usage:
208201
///
209202
/// ```
210-
/// let d = '1';
211-
///
212-
/// assert_eq!(d.to_digit(10), Some(1));
213-
///
214-
/// let d = 'f';
215-
///
216-
/// assert_eq!(d.to_digit(16), Some(15));
203+
/// assert_eq!('1'.to_digit(10), Some(1));
204+
/// assert_eq!('f'.to_digit(16), Some(15));
217205
/// ```
218206
///
219207
/// Passing a non-digit results in failure:
220208
///
221209
/// ```
222-
/// let d = 'f';
223-
///
224-
/// assert_eq!(d.to_digit(10), None);
225-
///
226-
/// let d = 'z';
227-
///
228-
/// assert_eq!(d.to_digit(16), None);
210+
/// assert_eq!('f'.to_digit(10), None);
211+
/// assert_eq!('z'.to_digit(16), None);
229212
/// ```
230213
///
231214
/// Passing a large radix, causing a panic:
@@ -234,9 +217,7 @@ impl char {
234217
/// use std::thread;
235218
///
236219
/// let result = thread::spawn(|| {
237-
/// let d = '1';
238-
///
239-
/// d.to_digit(37);
220+
/// '1'.to_digit(37);
240221
/// }).join();
241222
///
242223
/// assert!(result.is_err());
@@ -495,12 +476,8 @@ impl char {
495476
/// Basic usage:
496477
///
497478
/// ```
498-
/// let c = 'a';
499-
///
500-
/// assert!(c.is_alphabetic());
501-
///
502-
/// let c = '京';
503-
/// assert!(c.is_alphabetic());
479+
/// assert!('a'.is_alphabetic());
480+
/// assert!('京'.is_alphabetic());
504481
///
505482
/// let c = '💝';
506483
/// // love is many things, but it is not alphabetic
@@ -554,21 +531,13 @@ impl char {
554531
/// Basic usage:
555532
///
556533
/// ```
557-
/// let c = 'a';
558-
/// assert!(c.is_lowercase());
559-
///
560-
/// let c = 'δ';
561-
/// assert!(c.is_lowercase());
562-
///
563-
/// let c = 'A';
564-
/// assert!(!c.is_lowercase());
565-
///
566-
/// let c = 'Δ';
567-
/// assert!(!c.is_lowercase());
534+
/// assert!('a'.is_lowercase());
535+
/// assert!('δ'.is_lowercase());
536+
/// assert!(!'A'.is_lowercase());
537+
/// assert!(!'Δ'.is_lowercase());
568538
///
569539
/// // The various Chinese scripts do not have case, and so:
570-
/// let c = '中';
571-
/// assert!(!c.is_lowercase());
540+
/// assert!(!'中'.is_lowercase());
572541
/// ```
573542
#[stable(feature = "rust1", since = "1.0.0")]
574543
#[inline]
@@ -590,21 +559,13 @@ impl char {
590559
/// Basic usage:
591560
///
592561
/// ```
593-
/// let c = 'a';
594-
/// assert!(!c.is_uppercase());
595-
///
596-
/// let c = 'δ';
597-
/// assert!(!c.is_uppercase());
598-
///
599-
/// let c = 'A';
600-
/// assert!(c.is_uppercase());
601-
///
602-
/// let c = 'Δ';
603-
/// assert!(c.is_uppercase());
562+
/// assert!(!'a'.is_uppercase());
563+
/// assert!(!'δ'.is_uppercase());
564+
/// assert!('A'.is_uppercase());
565+
/// assert!('Δ'.is_uppercase());
604566
///
605567
/// // The various Chinese scripts do not have case, and so:
606-
/// let c = '中';
607-
/// assert!(!c.is_uppercase());
568+
/// assert!(!'中'.is_uppercase());
608569
/// ```
609570
#[stable(feature = "rust1", since = "1.0.0")]
610571
#[inline]
@@ -626,15 +587,12 @@ impl char {
626587
/// Basic usage:
627588
///
628589
/// ```
629-
/// let c = ' ';
630-
/// assert!(c.is_whitespace());
590+
/// assert!(' '.is_whitespace());
631591
///
632592
/// // a non-breaking space
633-
/// let c = '\u{A0}';
634-
/// assert!(c.is_whitespace());
593+
/// assert!('\u{A0}'.is_whitespace());
635594
///
636-
/// let c = '越';
637-
/// assert!(!c.is_whitespace());
595+
/// assert!(!'越'.is_whitespace());
638596
/// ```
639597
#[stable(feature = "rust1", since = "1.0.0")]
640598
#[inline]
@@ -656,29 +614,14 @@ impl char {
656614
/// Basic usage:
657615
///
658616
/// ```
659-
/// let c = '٣';
660-
/// assert!(c.is_alphanumeric());
661-
///
662-
/// let c = '7';
663-
/// assert!(c.is_alphanumeric());
664-
///
665-
/// let c = '৬';
666-
/// assert!(c.is_alphanumeric());
667-
///
668-
/// let c = 'K';
669-
/// assert!(c.is_alphanumeric());
670-
///
671-
/// let c = 'و';
672-
/// assert!(c.is_alphanumeric());
673-
///
674-
/// let c = '藏';
675-
/// assert!(c.is_alphanumeric());
676-
///
677-
/// let c = '¾';
678-
/// assert!(!c.is_alphanumeric());
679-
///
680-
/// let c = '①';
681-
/// assert!(!c.is_alphanumeric());
617+
/// assert!('٣'.is_alphanumeric());
618+
/// assert!('7'.is_alphanumeric());
619+
/// assert!('৬'.is_alphanumeric());
620+
/// assert!('K'.is_alphanumeric());
621+
/// assert!('و'.is_alphanumeric());
622+
/// assert!('藏'.is_alphanumeric());
623+
/// assert!(!'¾'.is_alphanumeric());
624+
/// assert!(!'①'.is_alphanumeric());
682625
/// ```
683626
#[stable(feature = "rust1", since = "1.0.0")]
684627
#[inline]
@@ -697,11 +640,8 @@ impl char {
697640
///
698641
/// ```
699642
/// // U+009C, STRING TERMINATOR
700-
/// let c = 'œ';
701-
/// assert!(c.is_control());
702-
///
703-
/// let c = 'q';
704-
/// assert!(!c.is_control());
643+
/// assert!('œ'.is_control());
644+
/// assert!(!'q'.is_control());
705645
/// ```
706646
#[stable(feature = "rust1", since = "1.0.0")]
707647
#[inline]
@@ -719,29 +659,14 @@ impl char {
719659
/// Basic usage:
720660
///
721661
/// ```
722-
/// let c = '٣';
723-
/// assert!(c.is_numeric());
724-
///
725-
/// let c = '7';
726-
/// assert!(c.is_numeric());
727-
///
728-
/// let c = '৬';
729-
/// assert!(c.is_numeric());
730-
///
731-
/// let c = 'K';
732-
/// assert!(!c.is_numeric());
733-
///
734-
/// let c = 'و';
735-
/// assert!(!c.is_numeric());
736-
///
737-
/// let c = '藏';
738-
/// assert!(!c.is_numeric());
739-
///
740-
/// let c = '¾';
741-
/// assert!(!c.is_numeric());
742-
///
743-
/// let c = '①';
744-
/// assert!(!c.is_numeric());
662+
/// assert!('٣'.is_numeric());
663+
/// assert!('7'.is_numeric());
664+
/// assert!('৬'.is_numeric());
665+
/// assert!(!'K'.is_numeric());
666+
/// assert!(!'و'.is_numeric());
667+
/// assert!(!'藏'.is_numeric());
668+
/// assert!(!'¾'.is_numeric());
669+
/// assert!(!'①'.is_numeric());
745670
/// ```
746671
#[stable(feature = "rust1", since = "1.0.0")]
747672
#[inline]
@@ -776,13 +701,10 @@ impl char {
776701
/// Basic usage:
777702
///
778703
/// ```
779-
/// let c = 'C';
780-
///
781-
/// assert_eq!(c.to_lowercase().next(), Some('c'));
704+
/// assert_eq!('C'.to_lowercase().next(), Some('c'));
782705
///
783706
/// // Japanese scripts do not have case, and so:
784-
/// let c = '山';
785-
/// assert_eq!(c.to_lowercase().next(), Some('山'));
707+
/// assert_eq!('山'.to_lowercase().next(), Some('山'));
786708
/// ```
787709
#[stable(feature = "rust1", since = "1.0.0")]
788710
#[inline]
@@ -813,12 +735,10 @@ impl char {
813735
/// Basic usage:
814736
///
815737
/// ```
816-
/// let c = 'c';
817-
/// assert_eq!(c.to_uppercase().next(), Some('C'));
738+
/// assert_eq!('c'.to_uppercase().next(), Some('C'));
818739
///
819740
/// // Japanese does not have case, and so:
820-
/// let c = '山';
821-
/// assert_eq!(c.to_uppercase().next(), Some('山'));
741+
/// assert_eq!('山'.to_uppercase().next(), Some('山'));
822742
/// ```
823743
///
824744
/// In Turkish, the equivalent of 'i' in Latin has five forms instead of two:
@@ -829,19 +749,15 @@ impl char {
829749
/// Note that the lowercase dotted 'i' is the same as the Latin. Therefore:
830750
///
831751
/// ```
832-
/// let i = 'i';
833-
///
834-
/// let upper_i = i.to_uppercase().next();
752+
/// let upper_i = 'i'.to_uppercase().next();
835753
/// ```
836754
///
837755
/// The value of `upper_i` here relies on the language of the text: if we're
838756
/// in `en-US`, it should be `Some('I')`, but if we're in `tr_TR`, it should
839757
/// be `Some('İ')`. `to_uppercase()` does not take this into account, and so:
840758
///
841759
/// ```
842-
/// let i = 'i';
843-
///
844-
/// let upper_i = i.to_uppercase().next();
760+
/// let upper_i = 'i'.to_uppercase().next();
845761
///
846762
/// assert_eq!(Some('I'), upper_i);
847763
/// ```

0 commit comments

Comments
 (0)