Skip to content

Commit 1e5811e

Browse files
committed
Rename to_ascii_{lower,upper} to to_ascii_{lower,upper}case, per rust-lang#14401
[breaking-change]
1 parent e64a819 commit 1e5811e

File tree

5 files changed

+41
-41
lines changed

5 files changed

+41
-41
lines changed

src/compiletest/errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ fn parse_expected(last_nonfollow_error: Option<uint>,
6767
re: &Regex) -> Option<(WhichLine, ExpectedError)> {
6868
re.captures(line).and_then(|caps| {
6969
let adjusts = caps.name("adjusts").unwrap_or("").len();
70-
let kind = caps.name("kind").unwrap_or("").to_ascii_lower();
70+
let kind = caps.name("kind").unwrap_or("").to_ascii_lowercase();
7171
let msg = caps.name("msg").unwrap_or("").trim().to_string();
7272
let follow = caps.name("follow").unwrap_or("").len() > 0;
7373

src/librustc/lint/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ pub struct Lint {
6868
impl Lint {
6969
/// Get the lint's name, with ASCII letters converted to lowercase.
7070
pub fn name_lower(&self) -> String {
71-
self.name.to_ascii_lower()
71+
self.name.to_ascii_lowercase()
7272
}
7373
}
7474

src/librustdoc/html/markdown.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ pub fn render(w: &mut fmt::Formatter, s: &str, print_toc: bool) -> fmt::Result {
235235
};
236236

237237
// Transform the contents of the header into a hyphenated string
238-
let id = s.words().map(|s| s.to_ascii_lower())
238+
let id = s.words().map(|s| s.to_ascii_lowercase())
239239
.collect::<Vec<String>>().connect("-");
240240

241241
// This is a terrible hack working around how hoedown gives us rendered

src/libstd/ascii.rs

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -409,12 +409,12 @@ pub trait OwnedAsciiExt {
409409
/// Convert the string to ASCII upper case:
410410
/// ASCII letters 'a' to 'z' are mapped to 'A' to 'Z',
411411
/// but non-ASCII letters are unchanged.
412-
fn into_ascii_upper(self) -> Self;
412+
fn into_ascii_uppercase(self) -> Self;
413413

414414
/// Convert the string to ASCII lower case:
415415
/// ASCII letters 'A' to 'Z' are mapped to 'a' to 'z',
416416
/// but non-ASCII letters are unchanged.
417-
fn into_ascii_lower(self) -> Self;
417+
fn into_ascii_lowercase(self) -> Self;
418418
}
419419

420420
/// Extension methods for ASCII-subset only operations on string slices
@@ -423,31 +423,31 @@ pub trait AsciiExt<T> for Sized? {
423423
/// Makes a copy of the string in ASCII upper case:
424424
/// ASCII letters 'a' to 'z' are mapped to 'A' to 'Z',
425425
/// but non-ASCII letters are unchanged.
426-
fn to_ascii_upper(&self) -> T;
426+
fn to_ascii_uppercase(&self) -> T;
427427

428428
/// Makes a copy of the string in ASCII lower case:
429429
/// ASCII letters 'A' to 'Z' are mapped to 'a' to 'z',
430430
/// but non-ASCII letters are unchanged.
431-
fn to_ascii_lower(&self) -> T;
431+
fn to_ascii_lowercase(&self) -> T;
432432

433433
/// Check that two strings are an ASCII case-insensitive match.
434-
/// Same as `to_ascii_lower(a) == to_ascii_lower(b)`,
434+
/// Same as `to_ascii_lowercase(a) == to_ascii_lower(b)`,
435435
/// but without allocating and copying temporary strings.
436436
fn eq_ignore_ascii_case(&self, other: &Self) -> bool;
437437
}
438438

439439
#[experimental = "would prefer to do this in a more general way"]
440440
impl AsciiExt<String> for str {
441441
#[inline]
442-
fn to_ascii_upper(&self) -> String {
443-
// Vec<u8>::to_ascii_upper() preserves the UTF-8 invariant.
444-
unsafe { String::from_utf8_unchecked(self.as_bytes().to_ascii_upper()) }
442+
fn to_ascii_uppercase(&self) -> String {
443+
// Vec<u8>::to_ascii_uppercase() preserves the UTF-8 invariant.
444+
unsafe { String::from_utf8_unchecked(self.as_bytes().to_ascii_uppercase()) }
445445
}
446446

447447
#[inline]
448-
fn to_ascii_lower(&self) -> String {
449-
// Vec<u8>::to_ascii_lower() preserves the UTF-8 invariant.
450-
unsafe { String::from_utf8_unchecked(self.as_bytes().to_ascii_lower()) }
448+
fn to_ascii_lowercase(&self) -> String {
449+
// Vec<u8>::to_ascii_lowercase() preserves the UTF-8 invariant.
450+
unsafe { String::from_utf8_unchecked(self.as_bytes().to_ascii_lowercase()) }
451451
}
452452

453453
#[inline]
@@ -459,27 +459,27 @@ impl AsciiExt<String> for str {
459459
#[experimental = "would prefer to do this in a more general way"]
460460
impl OwnedAsciiExt for String {
461461
#[inline]
462-
fn into_ascii_upper(self) -> String {
463-
// Vec<u8>::into_ascii_upper() preserves the UTF-8 invariant.
464-
unsafe { String::from_utf8_unchecked(self.into_bytes().into_ascii_upper()) }
462+
fn into_ascii_uppercase(self) -> String {
463+
// Vec<u8>::into_ascii_uppercase() preserves the UTF-8 invariant.
464+
unsafe { String::from_utf8_unchecked(self.into_bytes().into_ascii_uppercase()) }
465465
}
466466

467467
#[inline]
468-
fn into_ascii_lower(self) -> String {
469-
// Vec<u8>::into_ascii_lower() preserves the UTF-8 invariant.
470-
unsafe { String::from_utf8_unchecked(self.into_bytes().into_ascii_lower()) }
468+
fn into_ascii_lowercase(self) -> String {
469+
// Vec<u8>::into_ascii_lowercase() preserves the UTF-8 invariant.
470+
unsafe { String::from_utf8_unchecked(self.into_bytes().into_ascii_lowercase()) }
471471
}
472472
}
473473

474474
#[experimental = "would prefer to do this in a more general way"]
475475
impl AsciiExt<Vec<u8>> for [u8] {
476476
#[inline]
477-
fn to_ascii_upper(&self) -> Vec<u8> {
477+
fn to_ascii_uppercase(&self) -> Vec<u8> {
478478
self.iter().map(|&byte| ASCII_UPPER_MAP[byte as uint]).collect()
479479
}
480480

481481
#[inline]
482-
fn to_ascii_lower(&self) -> Vec<u8> {
482+
fn to_ascii_lowercase(&self) -> Vec<u8> {
483483
self.iter().map(|&byte| ASCII_LOWER_MAP[byte as uint]).collect()
484484
}
485485

@@ -497,15 +497,15 @@ impl AsciiExt<Vec<u8>> for [u8] {
497497
#[experimental = "would prefer to do this in a more general way"]
498498
impl OwnedAsciiExt for Vec<u8> {
499499
#[inline]
500-
fn into_ascii_upper(mut self) -> Vec<u8> {
500+
fn into_ascii_uppercase(mut self) -> Vec<u8> {
501501
for byte in self.iter_mut() {
502502
*byte = ASCII_UPPER_MAP[*byte as uint];
503503
}
504504
self
505505
}
506506

507507
#[inline]
508-
fn into_ascii_lower(mut self) -> Vec<u8> {
508+
fn into_ascii_lowercase(mut self) -> Vec<u8> {
509509
for byte in self.iter_mut() {
510510
*byte = ASCII_LOWER_MAP[*byte as uint];
511511
}
@@ -775,64 +775,64 @@ mod tests {
775775
}
776776

777777
#[test]
778-
fn test_to_ascii_upper() {
779-
assert_eq!("url()URL()uRl()ürl".to_ascii_upper(), "URL()URL()URL()üRL");
780-
assert_eq!("hıKß".to_ascii_upper(), "HıKß");
778+
fn test_to_ascii_uppercase() {
779+
assert_eq!("url()URL()uRl()ürl".to_ascii_uppercase(), "URL()URL()URL()üRL");
780+
assert_eq!("hıKß".to_ascii_uppercase(), "HıKß");
781781

782782
let mut i = 0;
783783
while i <= 500 {
784784
let upper = if 'a' as u32 <= i && i <= 'z' as u32 { i + 'A' as u32 - 'a' as u32 }
785785
else { i };
786-
assert_eq!((from_u32(i).unwrap()).to_string().to_ascii_upper(),
786+
assert_eq!((from_u32(i).unwrap()).to_string().to_ascii_uppercase(),
787787
(from_u32(upper).unwrap()).to_string());
788788
i += 1;
789789
}
790790
}
791791

792792
#[test]
793-
fn test_to_ascii_lower() {
794-
assert_eq!("url()URL()uRl()Ürl".to_ascii_lower(), "url()url()url()Ürl");
793+
fn test_to_ascii_lowercase() {
794+
assert_eq!("url()URL()uRl()Ürl".to_ascii_lowercase(), "url()url()url()Ürl");
795795
// Dotted capital I, Kelvin sign, Sharp S.
796-
assert_eq!("HİKß".to_ascii_lower(), "hİKß");
796+
assert_eq!("HİKß".to_ascii_lowercase(), "hİKß");
797797

798798
let mut i = 0;
799799
while i <= 500 {
800800
let lower = if 'A' as u32 <= i && i <= 'Z' as u32 { i + 'a' as u32 - 'A' as u32 }
801801
else { i };
802-
assert_eq!((from_u32(i).unwrap()).to_string().to_ascii_lower(),
802+
assert_eq!((from_u32(i).unwrap()).to_string().to_ascii_lowercase(),
803803
(from_u32(lower).unwrap()).to_string());
804804
i += 1;
805805
}
806806
}
807807

808808
#[test]
809-
fn test_into_ascii_upper() {
810-
assert_eq!(("url()URL()uRl()ürl".to_string()).into_ascii_upper(),
809+
fn test_into_ascii_uppercase() {
810+
assert_eq!(("url()URL()uRl()ürl".to_string()).into_ascii_uppercase(),
811811
"URL()URL()URL()üRL".to_string());
812-
assert_eq!(("hıKß".to_string()).into_ascii_upper(), "HıKß");
812+
assert_eq!(("hıKß".to_string()).into_ascii_uppercase(), "HıKß");
813813

814814
let mut i = 0;
815815
while i <= 500 {
816816
let upper = if 'a' as u32 <= i && i <= 'z' as u32 { i + 'A' as u32 - 'a' as u32 }
817817
else { i };
818-
assert_eq!((from_u32(i).unwrap()).to_string().into_ascii_upper(),
818+
assert_eq!((from_u32(i).unwrap()).to_string().into_ascii_uppercase(),
819819
(from_u32(upper).unwrap()).to_string());
820820
i += 1;
821821
}
822822
}
823823

824824
#[test]
825-
fn test_into_ascii_lower() {
826-
assert_eq!(("url()URL()uRl()Ürl".to_string()).into_ascii_lower(),
825+
fn test_into_ascii_lowercase() {
826+
assert_eq!(("url()URL()uRl()Ürl".to_string()).into_ascii_lowercase(),
827827
"url()url()url()Ürl");
828828
// Dotted capital I, Kelvin sign, Sharp S.
829-
assert_eq!(("HİKß".to_string()).into_ascii_lower(), "hİKß");
829+
assert_eq!(("HİKß".to_string()).into_ascii_lowercase(), "hİKß");
830830

831831
let mut i = 0;
832832
while i <= 500 {
833833
let lower = if 'A' as u32 <= i && i <= 'Z' as u32 { i + 'a' as u32 - 'A' as u32 }
834834
else { i };
835-
assert_eq!((from_u32(i).unwrap()).to_string().into_ascii_lower(),
835+
assert_eq!((from_u32(i).unwrap()).to_string().into_ascii_lowercase(),
836836
(from_u32(lower).unwrap()).to_string());
837837
i += 1;
838838
}

src/test/run-pass/issue-10683.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use std::ascii::AsciiExt;
1313
static NAME: &'static str = "hello world";
1414

1515
fn main() {
16-
match NAME.to_ascii_lower().as_slice() {
16+
match NAME.to_ascii_lowercase().as_slice() {
1717
"foo" => {}
1818
_ => {}
1919
}

0 commit comments

Comments
 (0)