@@ -298,198 +298,6 @@ pub trait AsciiExt {
298
298
fn is_ascii_control ( & self ) -> bool { unimplemented ! ( ) ; }
299
299
}
300
300
301
- // FIXME(LukasKalbertodt): this impl block can be removed in the future. This is
302
- // possible once the stage0 compiler is new enough to contain the inherent
303
- // ascii methods for `[str]`. See FIXME comment further down.
304
- #[ cfg( stage0) ]
305
- #[ stable( feature = "rust1" , since = "1.0.0" ) ]
306
- impl AsciiExt for str {
307
- type Owned = String ;
308
-
309
- #[ inline]
310
- fn is_ascii ( & self ) -> bool {
311
- self . bytes ( ) . all ( |b| b. is_ascii ( ) )
312
- }
313
-
314
- #[ inline]
315
- fn to_ascii_uppercase ( & self ) -> String {
316
- let mut bytes = self . as_bytes ( ) . to_vec ( ) ;
317
- bytes. make_ascii_uppercase ( ) ;
318
- // make_ascii_uppercase() preserves the UTF-8 invariant.
319
- unsafe { String :: from_utf8_unchecked ( bytes) }
320
- }
321
-
322
- #[ inline]
323
- fn to_ascii_lowercase ( & self ) -> String {
324
- let mut bytes = self . as_bytes ( ) . to_vec ( ) ;
325
- bytes. make_ascii_lowercase ( ) ;
326
- // make_ascii_uppercase() preserves the UTF-8 invariant.
327
- unsafe { String :: from_utf8_unchecked ( bytes) }
328
- }
329
-
330
- #[ inline]
331
- fn eq_ignore_ascii_case ( & self , other : & str ) -> bool {
332
- self . as_bytes ( ) . eq_ignore_ascii_case ( other. as_bytes ( ) )
333
- }
334
-
335
- fn make_ascii_uppercase ( & mut self ) {
336
- let me = unsafe { self . as_bytes_mut ( ) } ;
337
- me. make_ascii_uppercase ( )
338
- }
339
-
340
- fn make_ascii_lowercase ( & mut self ) {
341
- let me = unsafe { self . as_bytes_mut ( ) } ;
342
- me. make_ascii_lowercase ( )
343
- }
344
-
345
- #[ inline]
346
- fn is_ascii_alphabetic ( & self ) -> bool {
347
- self . bytes ( ) . all ( |b| b. is_ascii_alphabetic ( ) )
348
- }
349
-
350
- #[ inline]
351
- fn is_ascii_uppercase ( & self ) -> bool {
352
- self . bytes ( ) . all ( |b| b. is_ascii_uppercase ( ) )
353
- }
354
-
355
- #[ inline]
356
- fn is_ascii_lowercase ( & self ) -> bool {
357
- self . bytes ( ) . all ( |b| b. is_ascii_lowercase ( ) )
358
- }
359
-
360
- #[ inline]
361
- fn is_ascii_alphanumeric ( & self ) -> bool {
362
- self . bytes ( ) . all ( |b| b. is_ascii_alphanumeric ( ) )
363
- }
364
-
365
- #[ inline]
366
- fn is_ascii_digit ( & self ) -> bool {
367
- self . bytes ( ) . all ( |b| b. is_ascii_digit ( ) )
368
- }
369
-
370
- #[ inline]
371
- fn is_ascii_hexdigit ( & self ) -> bool {
372
- self . bytes ( ) . all ( |b| b. is_ascii_hexdigit ( ) )
373
- }
374
-
375
- #[ inline]
376
- fn is_ascii_punctuation ( & self ) -> bool {
377
- self . bytes ( ) . all ( |b| b. is_ascii_punctuation ( ) )
378
- }
379
-
380
- #[ inline]
381
- fn is_ascii_graphic ( & self ) -> bool {
382
- self . bytes ( ) . all ( |b| b. is_ascii_graphic ( ) )
383
- }
384
-
385
- #[ inline]
386
- fn is_ascii_whitespace ( & self ) -> bool {
387
- self . bytes ( ) . all ( |b| b. is_ascii_whitespace ( ) )
388
- }
389
-
390
- #[ inline]
391
- fn is_ascii_control ( & self ) -> bool {
392
- self . bytes ( ) . all ( |b| b. is_ascii_control ( ) )
393
- }
394
- }
395
-
396
- // FIXME(LukasKalbertodt): this impl block can be removed in the future. This is
397
- // possible once the stage0 compiler is new enough to contain the inherent
398
- // ascii methods for `[u8]`. See FIXME comment further down.
399
- #[ cfg( stage0) ]
400
- #[ stable( feature = "rust1" , since = "1.0.0" ) ]
401
- impl AsciiExt for [ u8 ] {
402
- type Owned = Vec < u8 > ;
403
- #[ inline]
404
- fn is_ascii ( & self ) -> bool {
405
- self . iter ( ) . all ( |b| b. is_ascii ( ) )
406
- }
407
-
408
- #[ inline]
409
- fn to_ascii_uppercase ( & self ) -> Vec < u8 > {
410
- let mut me = self . to_vec ( ) ;
411
- me. make_ascii_uppercase ( ) ;
412
- return me
413
- }
414
-
415
- #[ inline]
416
- fn to_ascii_lowercase ( & self ) -> Vec < u8 > {
417
- let mut me = self . to_vec ( ) ;
418
- me. make_ascii_lowercase ( ) ;
419
- return me
420
- }
421
-
422
- #[ inline]
423
- fn eq_ignore_ascii_case ( & self , other : & [ u8 ] ) -> bool {
424
- self . len ( ) == other. len ( ) &&
425
- self . iter ( ) . zip ( other) . all ( |( a, b) | {
426
- a. eq_ignore_ascii_case ( b)
427
- } )
428
- }
429
-
430
- fn make_ascii_uppercase ( & mut self ) {
431
- for byte in self {
432
- byte. make_ascii_uppercase ( ) ;
433
- }
434
- }
435
-
436
- fn make_ascii_lowercase ( & mut self ) {
437
- for byte in self {
438
- byte. make_ascii_lowercase ( ) ;
439
- }
440
- }
441
-
442
- #[ inline]
443
- fn is_ascii_alphabetic ( & self ) -> bool {
444
- self . iter ( ) . all ( |b| b. is_ascii_alphabetic ( ) )
445
- }
446
-
447
- #[ inline]
448
- fn is_ascii_uppercase ( & self ) -> bool {
449
- self . iter ( ) . all ( |b| b. is_ascii_uppercase ( ) )
450
- }
451
-
452
- #[ inline]
453
- fn is_ascii_lowercase ( & self ) -> bool {
454
- self . iter ( ) . all ( |b| b. is_ascii_lowercase ( ) )
455
- }
456
-
457
- #[ inline]
458
- fn is_ascii_alphanumeric ( & self ) -> bool {
459
- self . iter ( ) . all ( |b| b. is_ascii_alphanumeric ( ) )
460
- }
461
-
462
- #[ inline]
463
- fn is_ascii_digit ( & self ) -> bool {
464
- self . iter ( ) . all ( |b| b. is_ascii_digit ( ) )
465
- }
466
-
467
- #[ inline]
468
- fn is_ascii_hexdigit ( & self ) -> bool {
469
- self . iter ( ) . all ( |b| b. is_ascii_hexdigit ( ) )
470
- }
471
-
472
- #[ inline]
473
- fn is_ascii_punctuation ( & self ) -> bool {
474
- self . iter ( ) . all ( |b| b. is_ascii_punctuation ( ) )
475
- }
476
-
477
- #[ inline]
478
- fn is_ascii_graphic ( & self ) -> bool {
479
- self . iter ( ) . all ( |b| b. is_ascii_graphic ( ) )
480
- }
481
-
482
- #[ inline]
483
- fn is_ascii_whitespace ( & self ) -> bool {
484
- self . iter ( ) . all ( |b| b. is_ascii_whitespace ( ) )
485
- }
486
-
487
- #[ inline]
488
- fn is_ascii_control ( & self ) -> bool {
489
- self . iter ( ) . all ( |b| b. is_ascii_control ( ) )
490
- }
491
- }
492
-
493
301
macro_rules! delegating_ascii_methods {
494
302
( ) => {
495
303
#[ inline]
@@ -562,10 +370,6 @@ impl AsciiExt for char {
562
370
delegating_ascii_ctype_methods ! ( ) ;
563
371
}
564
372
565
- // FIXME(LukasKalbertodt): the macro invocation should replace the impl block
566
- // for `[u8]` above. But this is not possible until the stage0 compiler is new
567
- // enough to contain the inherent ascii methods for `[u8]`.
568
- #[ cfg( not( stage0) ) ]
569
373
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
570
374
impl AsciiExt for [ u8 ] {
571
375
type Owned = Vec < u8 > ;
@@ -623,10 +427,6 @@ impl AsciiExt for [u8] {
623
427
}
624
428
}
625
429
626
- // FIXME(LukasKalbertodt): the macro invocation should replace the impl block
627
- // for `str` above. But this is not possible until the stage0 compiler is new
628
- // enough to contain the inherent ascii methods for `str`.
629
- #[ cfg( not( stage0) ) ]
630
430
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
631
431
impl AsciiExt for str {
632
432
type Owned = String ;
0 commit comments