Skip to content
/ rust Public
forked from rust-lang/rust

Commit 83da317

Browse files
authored
Rollup merge of rust-lang#114641 - kupiakos:ascii-char-to-not-as, r=scottmcm
Rename copying `ascii::Char` methods from `as_` to `to_` Tracking issue: rust-lang#110998. The [API guidelines][naming] describe `as_` as used for borrowed -> borrowed operations, and `to_` for owned -> owned operations on `Copy` types. [naming]: https://rust-lang.github.io/api-guidelines/naming.html
2 parents e1cae5f + a22b9bf commit 83da317

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

library/core/src/ascii/ascii_char.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -518,14 +518,14 @@ impl AsciiChar {
518518
/// Gets this ASCII character as a byte.
519519
#[unstable(feature = "ascii_char", issue = "110998")]
520520
#[inline]
521-
pub const fn as_u8(self) -> u8 {
521+
pub const fn to_u8(self) -> u8 {
522522
self as u8
523523
}
524524

525525
/// Gets this ASCII character as a `char` Unicode Scalar Value.
526526
#[unstable(feature = "ascii_char", issue = "110998")]
527527
#[inline]
528-
pub const fn as_char(self) -> char {
528+
pub const fn to_char(self) -> char {
529529
self as u8 as char
530530
}
531531

library/core/src/escape.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,11 @@ impl<const N: usize> EscapeIterInner<N> {
9595
}
9696

9797
pub fn next(&mut self) -> Option<u8> {
98-
self.alive.next().map(|i| self.data[usize::from(i)].as_u8())
98+
self.alive.next().map(|i| self.data[usize::from(i)].to_u8())
9999
}
100100

101101
pub fn next_back(&mut self) -> Option<u8> {
102-
self.alive.next_back().map(|i| self.data[usize::from(i)].as_u8())
102+
self.alive.next_back().map(|i| self.data[usize::from(i)].to_u8())
103103
}
104104

105105
pub fn advance_by(&mut self, n: usize) -> Result<(), NonZeroUsize> {

0 commit comments

Comments
 (0)