@@ -400,12 +400,12 @@ pub trait StrAsciiExt {
400
400
impl < ' a > StrAsciiExt for & ' a str {
401
401
#[ inline]
402
402
fn to_ascii_upper ( & self ) -> String {
403
- unsafe { str_copy_map_bytes ( * self , ASCII_UPPER_MAP ) }
403
+ unsafe { str_copy_map_bytes ( * self , & ASCII_UPPER_MAP ) }
404
404
}
405
405
406
406
#[ inline]
407
407
fn to_ascii_lower ( & self ) -> String {
408
- unsafe { str_copy_map_bytes ( * self , ASCII_LOWER_MAP ) }
408
+ unsafe { str_copy_map_bytes ( * self , & ASCII_LOWER_MAP ) }
409
409
}
410
410
411
411
#[ inline]
@@ -422,17 +422,17 @@ impl<'a> StrAsciiExt for &'a str {
422
422
impl OwnedStrAsciiExt for String {
423
423
#[ inline]
424
424
fn into_ascii_upper ( self ) -> String {
425
- unsafe { str_map_bytes ( self , ASCII_UPPER_MAP ) }
425
+ unsafe { str_map_bytes ( self , & ASCII_UPPER_MAP ) }
426
426
}
427
427
428
428
#[ inline]
429
429
fn into_ascii_lower ( self ) -> String {
430
- unsafe { str_map_bytes ( self , ASCII_LOWER_MAP ) }
430
+ unsafe { str_map_bytes ( self , & ASCII_LOWER_MAP ) }
431
431
}
432
432
}
433
433
434
434
#[ inline]
435
- unsafe fn str_map_bytes ( string : String , map : & ' static [ u8 ] ) -> String {
435
+ unsafe fn str_map_bytes ( string : String , map : & [ u8 , .. 256 ] ) -> String {
436
436
let mut bytes = string. into_bytes( ) ;
437
437
438
438
for b in bytes. mut_iter ( ) {
@@ -443,15 +443,15 @@ unsafe fn str_map_bytes(string: String, map: &'static [u8]) -> String {
443
443
}
444
444
445
445
#[ inline]
446
- unsafe fn str_copy_map_bytes ( string : & str , map : & ' static [ u8 ] ) -> String {
446
+ unsafe fn str_copy_map_bytes( string : & str , map : & [ u8 , .. 256 ] ) -> String {
447
447
let mut s = String : : from_str( string) ;
448
448
for b in s. as_mut_bytes( ) . mut_iter( ) {
449
449
* b = map[ * b as uint] ;
450
450
}
451
451
s. into_string( )
452
452
}
453
453
454
- static ASCII_LOWER_MAP : & ' static [ u8 ] = & [
454
+ pub static ASCII_LOWER_MAP : [ u8 , .. 256 ] = [
455
455
0x00 , 0x01 , 0x02 , 0x03 , 0x04 , 0x05 , 0x06 , 0x07 ,
456
456
0x08 , 0x09 , 0x0a , 0x0b , 0x0c , 0x0d , 0x0e , 0x0f ,
457
457
0x10 , 0x11 , 0x12 , 0x13 , 0x14 , 0x15 , 0x16 , 0x17 ,
@@ -490,7 +490,7 @@ static ASCII_LOWER_MAP: &'static [u8] = &[
490
490
0xf8 , 0xf9 , 0xfa , 0xfb , 0xfc , 0xfd , 0xfe , 0xff ,
491
491
] ;
492
492
493
- static ASCII_UPPER_MAP : & ' static [ u8 ] = & [
493
+ pub static ASCII_UPPER_MAP : [ u8 , .. 256 ] = [
494
494
0x00 , 0x01 , 0x02 , 0x03 , 0x04 , 0x05 , 0x06 , 0x07 ,
495
495
0x08 , 0x09 , 0x0a , 0x0b , 0x0c , 0x0d , 0x0e , 0x0f ,
496
496
0x10 , 0x11 , 0x12 , 0x13 , 0x14 , 0x15 , 0x16 , 0x17 ,
0 commit comments