Skip to content

Commit 6733d8b

Browse files
committed
Fallout from deprecation
1 parent 7ce2d9c commit 6733d8b

File tree

3 files changed

+22
-15
lines changed

3 files changed

+22
-15
lines changed

src/libstd/ascii.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
//! Operations on ASCII strings and characters
1414
1515
#![unstable = "unsure about placement and naming"]
16+
#![allow(deprecated)]
1617

1718
use core::kinds::Sized;
1819
use fmt;
@@ -36,6 +37,7 @@ impl Ascii {
3637
self.chr
3738
}
3839

40+
/// Deprecated: use `as_byte` isntead.
3941
#[deprecated = "use as_byte"]
4042
pub fn to_byte(self) -> u8 {
4143
self.as_byte()
@@ -48,6 +50,12 @@ impl Ascii {
4850
self.chr as char
4951
}
5052

53+
/// Deprecated: use `as_char` isntead.
54+
#[deprecated = "use as_char"]
55+
pub fn to_char(self) -> char {
56+
self.as_char()
57+
}
58+
5159
/// Convert to lowercase.
5260
#[inline]
5361
#[stable]

src/libstd/path/windows.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -235,10 +235,10 @@ impl GenericPathUnsafe for Path {
235235
let repr = me.repr.as_slice();
236236
match me.prefix {
237237
Some(DiskPrefix) => {
238-
repr.as_bytes()[0] == path.as_bytes()[0].to_ascii().to_uppercase().to_byte()
238+
repr.as_bytes()[0] == path.as_bytes()[0].to_ascii().to_uppercase().as_byte()
239239
}
240240
Some(VerbatimDiskPrefix) => {
241-
repr.as_bytes()[4] == path.as_bytes()[0].to_ascii().to_uppercase().to_byte()
241+
repr.as_bytes()[4] == path.as_bytes()[0].to_ascii().to_uppercase().as_byte()
242242
}
243243
_ => false
244244
}
@@ -673,14 +673,17 @@ impl Path {
673673
match (self.prefix, other.prefix) {
674674
(Some(DiskPrefix), Some(VerbatimDiskPrefix)) => {
675675
self.is_absolute() &&
676-
s_repr.as_bytes()[0].to_ascii().eq_ignore_case(o_repr.as_bytes()[4].to_ascii())
676+
s_repr.as_bytes()[0].to_ascii().to_lowercase() ==
677+
o_repr.as_bytes()[4].to_ascii().to_lowercase()
677678
}
678679
(Some(VerbatimDiskPrefix), Some(DiskPrefix)) => {
679680
other.is_absolute() &&
680-
s_repr.as_bytes()[4].to_ascii().eq_ignore_case(o_repr.as_bytes()[0].to_ascii())
681+
s_repr.as_bytes()[4].to_ascii().to_lowercase() ==
682+
o_repr.as_bytes()[0].to_ascii().to_lowercase()
681683
}
682684
(Some(VerbatimDiskPrefix), Some(VerbatimDiskPrefix)) => {
683-
s_repr.as_bytes()[4].to_ascii().eq_ignore_case(o_repr.as_bytes()[4].to_ascii())
685+
s_repr.as_bytes()[4].to_ascii().to_lowercase() ==
686+
o_repr.as_bytes()[4].to_ascii().to_lowercase()
684687
}
685688
(Some(UNCPrefix(_,_)), Some(VerbatimUNCPrefix(_,_))) => {
686689
s_repr.slice(2, self.prefix_len()) == o_repr.slice(8, other.prefix_len())
@@ -747,10 +750,7 @@ impl Path {
747750
let mut s = String::from_str(s.slice_to(len));
748751
unsafe {
749752
let v = s.as_mut_vec();
750-
v[0] = (*v)[0]
751-
.to_ascii()
752-
.to_uppercase()
753-
.to_byte();
753+
v[0] = (*v)[0].to_ascii().to_uppercase().as_byte();
754754
}
755755
if is_abs {
756756
// normalize C:/ to C:\
@@ -765,7 +765,7 @@ impl Path {
765765
let mut s = String::from_str(s.slice_to(len));
766766
unsafe {
767767
let v = s.as_mut_vec();
768-
v[4] = (*v)[4].to_ascii().to_uppercase().to_byte();
768+
v[4] = (*v)[4].to_ascii().to_uppercase().as_byte();
769769
}
770770
Some(s)
771771
}
@@ -787,13 +787,13 @@ impl Path {
787787
match prefix {
788788
Some(DiskPrefix) => {
789789
s.push(prefix_.as_bytes()[0].to_ascii()
790-
.to_uppercase().to_char());
790+
.to_uppercase().as_char());
791791
s.push(':');
792792
}
793793
Some(VerbatimDiskPrefix) => {
794794
s.push_str(prefix_.slice_to(4));
795795
s.push(prefix_.as_bytes()[4].to_ascii()
796-
.to_uppercase().to_char());
796+
.to_uppercase().as_char());
797797
s.push_str(prefix_.slice_from(5));
798798
}
799799
Some(UNCPrefix(a,b)) => {

src/libterm/terminfo/parm.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -535,9 +535,8 @@ fn format(val: Param, op: FormatOp, flags: Flags) -> Result<Vec<u8> ,String> {
535535
FormatHEX => {
536536
s = s.as_slice()
537537
.to_ascii()
538-
.to_uppercase()
539-
.into_bytes()
540-
.into_iter()
538+
.iter()
539+
.map(|b| b.to_uppercase().as_byte())
541540
.collect();
542541
if flags.alternate {
543542
let s_ = replace(&mut s, vec!(b'0', b'X'));

0 commit comments

Comments
 (0)