File tree Expand file tree Collapse file tree 1 file changed +19
-15
lines changed Expand file tree Collapse file tree 1 file changed +19
-15
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ const FORBIDDEN_SPECIFIC_CHARS: &[u32] = &[
66#[ inline]
77fn is_forbidden_domain_char ( cp : u32 ) -> bool {
88 // Control characters (fast range checks)
9- if cp <= 0x001F || ( cp >= 0x007F && cp <= 0x009F ) {
9+ if cp <= 0x001F || ( 0x007F ..= 0x009F ) . contains ( & cp ) {
1010 return true ;
1111 }
1212
@@ -21,20 +21,24 @@ pub fn valid_name_code_point(cp: u32) -> bool {
2121 }
2222
2323 // Range-based checks for better performance
24- match cp {
25- 0x00B7 => true ,
26- 0x00C0 ..=0x00D6 | 0x00D8 ..=0x00F6 | 0x00F8 ..=0x037D => true ,
27- 0x037F ..=0x1FFF => true ,
28- 0x200C | 0x200D => true ,
29- 0x203F | 0x2040 => true ,
30- 0x2070 ..=0x218F => true ,
31- 0x2C00 ..=0x2FEF => true ,
32- 0x3001 ..=0xD7FF => true ,
33- 0xF900 ..=0xFDCF => true ,
34- 0xFDF0 ..=0xFFFD => true ,
35- 0x10000 ..=0xEFFFF => true ,
36- _ => false ,
37- }
24+ matches ! (
25+ cp,
26+ 0x00B7
27+ | 0x00C0 ..=0x00D6
28+ | 0x00D8 ..=0x00F6
29+ | 0x00F8 ..=0x037D
30+ | 0x037F ..=0x1FFF
31+ | 0x200C
32+ | 0x200D
33+ | 0x203F
34+ | 0x2040
35+ | 0x2070 ..=0x218F
36+ | 0x2C00 ..=0x2FEF
37+ | 0x3001 ..=0xD7FF
38+ | 0xF900 ..=0xFDCF
39+ | 0xFDF0 ..=0xFFFD
40+ | 0x10000 ..=0xEFFFF
41+ )
3842}
3943
4044pub fn valid_name_code_point_first_position ( cp : u32 ) -> bool {
You can’t perform that action at this time.
0 commit comments