@@ -4283,10 +4283,7 @@ impl u8 {
4283
4283
#[ stable( feature = "ascii_ctype_on_intrinsics" , since = "1.24.0" ) ]
4284
4284
#[ inline]
4285
4285
pub fn is_ascii_alphabetic ( & self ) -> bool {
4286
- match * self {
4287
- b'A' ..=b'Z' | b'a' ..=b'z' => true ,
4288
- _ => false ,
4289
- }
4286
+ matches ! ( * self , b'A' ..=b'Z' | b'a' ..=b'z' )
4290
4287
}
4291
4288
4292
4289
/// Checks if the value is an ASCII uppercase character:
@@ -4318,10 +4315,7 @@ impl u8 {
4318
4315
#[ stable( feature = "ascii_ctype_on_intrinsics" , since = "1.24.0" ) ]
4319
4316
#[ inline]
4320
4317
pub fn is_ascii_uppercase ( & self ) -> bool {
4321
- match * self {
4322
- b'A' ..=b'Z' => true ,
4323
- _ => false ,
4324
- }
4318
+ matches ! ( * self , b'A' ..=b'Z' )
4325
4319
}
4326
4320
4327
4321
/// Checks if the value is an ASCII lowercase character:
@@ -4353,10 +4347,7 @@ impl u8 {
4353
4347
#[ stable( feature = "ascii_ctype_on_intrinsics" , since = "1.24.0" ) ]
4354
4348
#[ inline]
4355
4349
pub fn is_ascii_lowercase ( & self ) -> bool {
4356
- match * self {
4357
- b'a' ..=b'z' => true ,
4358
- _ => false ,
4359
- }
4350
+ matches ! ( * self , b'a' ..=b'z' )
4360
4351
}
4361
4352
4362
4353
/// Checks if the value is an ASCII alphanumeric character:
@@ -4391,10 +4382,7 @@ impl u8 {
4391
4382
#[ stable( feature = "ascii_ctype_on_intrinsics" , since = "1.24.0" ) ]
4392
4383
#[ inline]
4393
4384
pub fn is_ascii_alphanumeric ( & self ) -> bool {
4394
- match * self {
4395
- b'0' ..=b'9' | b'A' ..=b'Z' | b'a' ..=b'z' => true ,
4396
- _ => false ,
4397
- }
4385
+ matches ! ( * self , b'0' ..=b'9' | b'A' ..=b'Z' | b'a' ..=b'z' )
4398
4386
}
4399
4387
4400
4388
/// Checks if the value is an ASCII decimal digit:
@@ -4426,10 +4414,7 @@ impl u8 {
4426
4414
#[ stable( feature = "ascii_ctype_on_intrinsics" , since = "1.24.0" ) ]
4427
4415
#[ inline]
4428
4416
pub fn is_ascii_digit ( & self ) -> bool {
4429
- match * self {
4430
- b'0' ..=b'9' => true ,
4431
- _ => false ,
4432
- }
4417
+ matches ! ( * self , b'0' ..=b'9' )
4433
4418
}
4434
4419
4435
4420
/// Checks if the value is an ASCII hexadecimal digit:
@@ -4464,10 +4449,7 @@ impl u8 {
4464
4449
#[ stable( feature = "ascii_ctype_on_intrinsics" , since = "1.24.0" ) ]
4465
4450
#[ inline]
4466
4451
pub fn is_ascii_hexdigit ( & self ) -> bool {
4467
- match * self {
4468
- b'0' ..=b'9' | b'A' ..=b'F' | b'a' ..=b'f' => true ,
4469
- _ => false ,
4470
- }
4452
+ matches ! ( * self , b'0' ..=b'9' | b'A' ..=b'F' | b'a' ..=b'f' )
4471
4453
}
4472
4454
4473
4455
/// Checks if the value is an ASCII punctuation character:
@@ -4503,10 +4485,7 @@ impl u8 {
4503
4485
#[ stable( feature = "ascii_ctype_on_intrinsics" , since = "1.24.0" ) ]
4504
4486
#[ inline]
4505
4487
pub fn is_ascii_punctuation ( & self ) -> bool {
4506
- match * self {
4507
- b'!' ..=b'/' | b':' ..=b'@' | b'[' ..=b'`' | b'{' ..=b'~' => true ,
4508
- _ => false ,
4509
- }
4488
+ matches ! ( * self , b'!' ..=b'/' | b':' ..=b'@' | b'[' ..=b'`' | b'{' ..=b'~' )
4510
4489
}
4511
4490
4512
4491
/// Checks if the value is an ASCII graphic character:
@@ -4538,10 +4517,7 @@ impl u8 {
4538
4517
#[ stable( feature = "ascii_ctype_on_intrinsics" , since = "1.24.0" ) ]
4539
4518
#[ inline]
4540
4519
pub fn is_ascii_graphic ( & self ) -> bool {
4541
- match * self {
4542
- b'!' ..=b'~' => true ,
4543
- _ => false ,
4544
- }
4520
+ matches ! ( * self , b'!' ..=b'~' )
4545
4521
}
4546
4522
4547
4523
/// Checks if the value is an ASCII whitespace character:
@@ -4590,10 +4566,7 @@ impl u8 {
4590
4566
#[ stable( feature = "ascii_ctype_on_intrinsics" , since = "1.24.0" ) ]
4591
4567
#[ inline]
4592
4568
pub fn is_ascii_whitespace ( & self ) -> bool {
4593
- match * self {
4594
- b'\t' | b'\n' | b'\x0C' | b'\r' | b' ' => true ,
4595
- _ => false ,
4596
- }
4569
+ matches ! ( * self , b'\t' | b'\n' | b'\x0C' | b'\r' | b' ' )
4597
4570
}
4598
4571
4599
4572
/// Checks if the value is an ASCII control character:
@@ -4627,10 +4600,7 @@ impl u8 {
4627
4600
#[ stable( feature = "ascii_ctype_on_intrinsics" , since = "1.24.0" ) ]
4628
4601
#[ inline]
4629
4602
pub fn is_ascii_control ( & self ) -> bool {
4630
- match * self {
4631
- b'\0' ..=b'\x1F' | b'\x7F' => true ,
4632
- _ => false ,
4633
- }
4603
+ matches ! ( * self , b'\0' ..=b'\x1F' | b'\x7F' )
4634
4604
}
4635
4605
}
4636
4606
0 commit comments