@@ -4286,10 +4286,7 @@ impl u8 {
4286
4286
#[ stable( feature = "ascii_ctype_on_intrinsics" , since = "1.24.0" ) ]
4287
4287
#[ inline]
4288
4288
pub fn is_ascii_alphabetic ( & self ) -> bool {
4289
- match * self {
4290
- b'A' ..=b'Z' | b'a' ..=b'z' => true ,
4291
- _ => false ,
4292
- }
4289
+ matches ! ( * self , b'A' ..=b'Z' | b'a' ..=b'z' )
4293
4290
}
4294
4291
4295
4292
/// Checks if the value is an ASCII uppercase character:
@@ -4321,10 +4318,7 @@ impl u8 {
4321
4318
#[ stable( feature = "ascii_ctype_on_intrinsics" , since = "1.24.0" ) ]
4322
4319
#[ inline]
4323
4320
pub fn is_ascii_uppercase ( & self ) -> bool {
4324
- match * self {
4325
- b'A' ..=b'Z' => true ,
4326
- _ => false ,
4327
- }
4321
+ matches ! ( * self , b'A' ..=b'Z' )
4328
4322
}
4329
4323
4330
4324
/// Checks if the value is an ASCII lowercase character:
@@ -4356,10 +4350,7 @@ impl u8 {
4356
4350
#[ stable( feature = "ascii_ctype_on_intrinsics" , since = "1.24.0" ) ]
4357
4351
#[ inline]
4358
4352
pub fn is_ascii_lowercase ( & self ) -> bool {
4359
- match * self {
4360
- b'a' ..=b'z' => true ,
4361
- _ => false ,
4362
- }
4353
+ matches ! ( * self , b'a' ..=b'z' )
4363
4354
}
4364
4355
4365
4356
/// Checks if the value is an ASCII alphanumeric character:
@@ -4394,10 +4385,7 @@ impl u8 {
4394
4385
#[ stable( feature = "ascii_ctype_on_intrinsics" , since = "1.24.0" ) ]
4395
4386
#[ inline]
4396
4387
pub fn is_ascii_alphanumeric ( & self ) -> bool {
4397
- match * self {
4398
- b'0' ..=b'9' | b'A' ..=b'Z' | b'a' ..=b'z' => true ,
4399
- _ => false ,
4400
- }
4388
+ matches ! ( * self , b'0' ..=b'9' | b'A' ..=b'Z' | b'a' ..=b'z' )
4401
4389
}
4402
4390
4403
4391
/// Checks if the value is an ASCII decimal digit:
@@ -4429,10 +4417,7 @@ impl u8 {
4429
4417
#[ stable( feature = "ascii_ctype_on_intrinsics" , since = "1.24.0" ) ]
4430
4418
#[ inline]
4431
4419
pub fn is_ascii_digit ( & self ) -> bool {
4432
- match * self {
4433
- b'0' ..=b'9' => true ,
4434
- _ => false ,
4435
- }
4420
+ matches ! ( * self , b'0' ..=b'9' )
4436
4421
}
4437
4422
4438
4423
/// Checks if the value is an ASCII hexadecimal digit:
@@ -4467,10 +4452,7 @@ impl u8 {
4467
4452
#[ stable( feature = "ascii_ctype_on_intrinsics" , since = "1.24.0" ) ]
4468
4453
#[ inline]
4469
4454
pub fn is_ascii_hexdigit ( & self ) -> bool {
4470
- match * self {
4471
- b'0' ..=b'9' | b'A' ..=b'F' | b'a' ..=b'f' => true ,
4472
- _ => false ,
4473
- }
4455
+ matches ! ( * self , b'0' ..=b'9' | b'A' ..=b'F' | b'a' ..=b'f' )
4474
4456
}
4475
4457
4476
4458
/// Checks if the value is an ASCII punctuation character:
@@ -4506,10 +4488,7 @@ impl u8 {
4506
4488
#[ stable( feature = "ascii_ctype_on_intrinsics" , since = "1.24.0" ) ]
4507
4489
#[ inline]
4508
4490
pub fn is_ascii_punctuation ( & self ) -> bool {
4509
- match * self {
4510
- b'!' ..=b'/' | b':' ..=b'@' | b'[' ..=b'`' | b'{' ..=b'~' => true ,
4511
- _ => false ,
4512
- }
4491
+ matches ! ( * self , b'!' ..=b'/' | b':' ..=b'@' | b'[' ..=b'`' | b'{' ..=b'~' )
4513
4492
}
4514
4493
4515
4494
/// Checks if the value is an ASCII graphic character:
@@ -4541,10 +4520,7 @@ impl u8 {
4541
4520
#[ stable( feature = "ascii_ctype_on_intrinsics" , since = "1.24.0" ) ]
4542
4521
#[ inline]
4543
4522
pub fn is_ascii_graphic ( & self ) -> bool {
4544
- match * self {
4545
- b'!' ..=b'~' => true ,
4546
- _ => false ,
4547
- }
4523
+ matches ! ( * self , b'!' ..=b'~' )
4548
4524
}
4549
4525
4550
4526
/// Checks if the value is an ASCII whitespace character:
@@ -4593,10 +4569,7 @@ impl u8 {
4593
4569
#[ stable( feature = "ascii_ctype_on_intrinsics" , since = "1.24.0" ) ]
4594
4570
#[ inline]
4595
4571
pub fn is_ascii_whitespace ( & self ) -> bool {
4596
- match * self {
4597
- b'\t' | b'\n' | b'\x0C' | b'\r' | b' ' => true ,
4598
- _ => false ,
4599
- }
4572
+ matches ! ( * self , b'\t' | b'\n' | b'\x0C' | b'\r' | b' ' )
4600
4573
}
4601
4574
4602
4575
/// Checks if the value is an ASCII control character:
@@ -4630,10 +4603,7 @@ impl u8 {
4630
4603
#[ stable( feature = "ascii_ctype_on_intrinsics" , since = "1.24.0" ) ]
4631
4604
#[ inline]
4632
4605
pub fn is_ascii_control ( & self ) -> bool {
4633
- match * self {
4634
- b'\0' ..=b'\x1F' | b'\x7F' => true ,
4635
- _ => false ,
4636
- }
4606
+ matches ! ( * self , b'\0' ..=b'\x1F' | b'\x7F' )
4637
4607
}
4638
4608
}
4639
4609
0 commit comments