diff options
| author | Alyssa Haroldsen <kupiakos@google.com> | 2023-08-08 15:52:52 -0700 |
|---|---|---|
| committer | Alyssa Haroldsen <kupiakos@google.com> | 2023-08-08 16:03:47 -0700 |
| commit | a22b9bf2e699b67f060142af4d26728ee9020f36 (patch) | |
| tree | d87d50938eeac7c9fd2bc581ada9d0b1d885613c | |
| parent | f88a8b71cebb730cbd5058c45ebcae1d4d9be377 (diff) | |
| download | rust-a22b9bf2e699b67f060142af4d26728ee9020f36.tar.gz rust-a22b9bf2e699b67f060142af4d26728ee9020f36.zip | |
Rename copying `ascii::Char` methods from `as_` to `to_`
Tracking issue: #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
| -rw-r--r-- | library/core/src/ascii/ascii_char.rs | 4 | ||||
| -rw-r--r-- | library/core/src/escape.rs | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/library/core/src/ascii/ascii_char.rs b/library/core/src/ascii/ascii_char.rs index f093a0990d1..5378b210e67 100644 --- a/library/core/src/ascii/ascii_char.rs +++ b/library/core/src/ascii/ascii_char.rs @@ -518,14 +518,14 @@ impl AsciiChar { /// Gets this ASCII character as a byte. #[unstable(feature = "ascii_char", issue = "110998")] #[inline] - pub const fn as_u8(self) -> u8 { + pub const fn to_u8(self) -> u8 { self as u8 } /// Gets this ASCII character as a `char` Unicode Scalar Value. #[unstable(feature = "ascii_char", issue = "110998")] #[inline] - pub const fn as_char(self) -> char { + pub const fn to_char(self) -> char { self as u8 as char } diff --git a/library/core/src/escape.rs b/library/core/src/escape.rs index 3d471419bb8..24bb9ad1ad1 100644 --- a/library/core/src/escape.rs +++ b/library/core/src/escape.rs @@ -95,11 +95,11 @@ impl<const N: usize> EscapeIterInner<N> { } pub fn next(&mut self) -> Option<u8> { - self.alive.next().map(|i| self.data[usize::from(i)].as_u8()) + self.alive.next().map(|i| self.data[usize::from(i)].to_u8()) } pub fn next_back(&mut self) -> Option<u8> { - self.alive.next_back().map(|i| self.data[usize::from(i)].as_u8()) + self.alive.next_back().map(|i| self.data[usize::from(i)].to_u8()) } pub fn advance_by(&mut self, n: usize) -> Result<(), NonZeroUsize> { |
