File tree Expand file tree Collapse file tree 4 files changed +5
-28
lines changed
src/tools/unicode-table-generator/src Expand file tree Collapse file tree 4 files changed +5
-28
lines changed Original file line number Diff line number Diff line change @@ -950,7 +950,11 @@ impl char {
950
950
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
951
951
#[ inline]
952
952
pub fn is_control ( self ) -> bool {
953
- unicode:: Cc ( self )
953
+ // According to
954
+ // https://www.unicode.org/policies/stability_policy.html#Property_Value,
955
+ // the set of codepoints in `Cc` will never change.
956
+ // So we can just hard-code the patterns to match against instead of using a table.
957
+ matches ! ( self , '\0' ..='\x1f' | '\x7f' ..='\u{9f}' )
954
958
}
955
959
956
960
/// Returns `true` if this `char` has the `Grapheme_Extend` property.
Original file line number Diff line number Diff line change @@ -9,7 +9,6 @@ pub use unicode_data::conversions;
9
9
10
10
#[ rustfmt:: skip]
11
11
pub ( crate ) use unicode_data:: alphabetic:: lookup as Alphabetic ;
12
- pub ( crate ) use unicode_data:: cc:: lookup as Cc ;
13
12
pub ( crate ) use unicode_data:: grapheme_extend:: lookup as Grapheme_Extend ;
14
13
pub ( crate ) use unicode_data:: lowercase:: lookup as Lowercase ;
15
14
pub ( crate ) use unicode_data:: n:: lookup as N ;
Original file line number Diff line number Diff line change @@ -358,31 +358,6 @@ pub mod cased {
358
358
}
359
359
}
360
360
361
- #[ rustfmt:: skip]
362
- pub mod cc {
363
- use super :: ShortOffsetRunHeader ;
364
-
365
- static SHORT_OFFSET_RUNS : [ ShortOffsetRunHeader ; 1 ] = [
366
- ShortOffsetRunHeader :: new ( 0 , 1114272 ) ,
367
- ] ;
368
- static OFFSETS : [ u8 ; 5 ] = [
369
- 0 , 32 , 95 , 33 , 0 ,
370
- ] ;
371
- pub fn lookup ( c : char ) -> bool {
372
- const {
373
- assert ! ( SHORT_OFFSET_RUNS . last( ) . unwrap( ) . 0 > char :: MAX as u32 ) ;
374
- let mut i = 0 ;
375
- while i < SHORT_OFFSET_RUNS . len ( ) {
376
- assert ! ( SHORT_OFFSET_RUNS [ i] . start_index( ) < OFFSETS . len( ) ) ;
377
- i += 1 ;
378
- }
379
- }
380
- // SAFETY: We just ensured the last element of `SHORT_OFFSET_RUNS` is greater than `std::char::MAX`
381
- // and the start indices of all elements in `SHORT_OFFSET_RUNS` are smaller than `OFFSETS.len()`.
382
- unsafe { super :: skip_search ( c, & SHORT_OFFSET_RUNS , & OFFSETS ) }
383
- }
384
- }
385
-
386
361
#[ rustfmt:: skip]
387
362
pub mod grapheme_extend {
388
363
use super :: ShortOffsetRunHeader ;
Original file line number Diff line number Diff line change @@ -92,7 +92,6 @@ static PROPERTIES: &[&str] = &[
92
92
"Case_Ignorable" ,
93
93
"Grapheme_Extend" ,
94
94
"White_Space" ,
95
- "Cc" ,
96
95
"N" ,
97
96
] ;
98
97
You can’t perform that action at this time.
0 commit comments