diff options
| author | Fenrir <[email protected]> | 2018-04-14 20:02:05 -0600 |
|---|---|---|
| committer | Fenrir <[email protected]> | 2018-04-21 16:35:01 -0600 |
| commit | b330206f5590d88a2f995321d2ea847ded951d1d (patch) | |
| tree | 4fecd0ca00b754c494e96b13e9837db48de93109 /ctr-std/src/sys_common | |
| parent | Move more implementation details to `imp` module (diff) | |
| download | ctru-rs-b330206f5590d88a2f995321d2ea847ded951d1d.tar.xz ctru-rs-b330206f5590d88a2f995321d2ea847ded951d1d.zip | |
Update for Rust nightly 2018-04-19
Diffstat (limited to 'ctr-std/src/sys_common')
| -rw-r--r-- | ctr-std/src/sys_common/at_exit_imp.rs | 2 | ||||
| -rw-r--r-- | ctr-std/src/sys_common/bytestring.rs | 2 | ||||
| -rw-r--r-- | ctr-std/src/sys_common/process.rs | 2 | ||||
| -rw-r--r-- | ctr-std/src/sys_common/thread.rs | 2 | ||||
| -rw-r--r-- | ctr-std/src/sys_common/wtf8.rs | 45 |
5 files changed, 25 insertions, 28 deletions
diff --git a/ctr-std/src/sys_common/at_exit_imp.rs b/ctr-std/src/sys_common/at_exit_imp.rs index ce6fd4c..f511981 100644 --- a/ctr-std/src/sys_common/at_exit_imp.rs +++ b/ctr-std/src/sys_common/at_exit_imp.rs @@ -12,7 +12,7 @@ //! //! Documentation can be found on the `rt::at_exit` function. -use alloc::boxed::FnBox; +use alloc_crate::boxed::FnBox; use ptr; use sys_common::mutex::Mutex; diff --git a/ctr-std/src/sys_common/bytestring.rs b/ctr-std/src/sys_common/bytestring.rs index eb9cad0..971b839 100644 --- a/ctr-std/src/sys_common/bytestring.rs +++ b/ctr-std/src/sys_common/bytestring.rs @@ -11,7 +11,7 @@ #![allow(dead_code)] use fmt::{Formatter, Result, Write}; -use std_unicode::lossy::{Utf8Lossy, Utf8LossyChunk}; +use core::str::lossy::{Utf8Lossy, Utf8LossyChunk}; pub fn debug_fmt_bytestring(slice: &[u8], f: &mut Formatter) -> Result { // Writes out a valid unicode string with the correct escape sequences diff --git a/ctr-std/src/sys_common/process.rs b/ctr-std/src/sys_common/process.rs index fd1a5fd..0a64d78 100644 --- a/ctr-std/src/sys_common/process.rs +++ b/ctr-std/src/sys_common/process.rs @@ -14,7 +14,7 @@ use ffi::{OsStr, OsString}; use env; use collections::BTreeMap; -use alloc::borrow::Borrow; +use alloc_crate::borrow::Borrow; pub trait EnvKey: From<OsString> + Into<OsString> + diff --git a/ctr-std/src/sys_common/thread.rs b/ctr-std/src/sys_common/thread.rs index f1379b6..cafa353 100644 --- a/ctr-std/src/sys_common/thread.rs +++ b/ctr-std/src/sys_common/thread.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use alloc::boxed::FnBox; +use alloc_crate::boxed::FnBox; use env; use sync::atomic::{self, Ordering}; use sys::stack_overflow; diff --git a/ctr-std/src/sys_common/wtf8.rs b/ctr-std/src/sys_common/wtf8.rs index 46d554d..dda4e1b 100644 --- a/ctr-std/src/sys_common/wtf8.rs +++ b/ctr-std/src/sys_common/wtf8.rs @@ -27,7 +27,6 @@ use core::str::next_code_point; -use ascii::*; use borrow::Cow; use char; use fmt; @@ -254,6 +253,11 @@ impl Wtf8Buf { self.bytes.shrink_to_fit() } + #[inline] + pub fn shrink_to(&mut self, min_capacity: usize) { + self.bytes.shrink_to(min_capacity) + } + /// Returns the number of bytes that this string buffer can hold without reallocating. #[inline] pub fn capacity(&self) -> usize { @@ -428,20 +432,15 @@ impl fmt::Debug for Wtf8 { formatter.write_str("\"")?; let mut pos = 0; - loop { - match self.next_surrogate(pos) { - None => break, - Some((surrogate_pos, surrogate)) => { - write_str_escaped( - formatter, - unsafe { str::from_utf8_unchecked( - &self.bytes[pos .. surrogate_pos] - )}, - )?; - write!(formatter, "\\u{{{:x}}}", surrogate)?; - pos = surrogate_pos + 3; - } - } + while let Some((surrogate_pos, surrogate)) = self.next_surrogate(pos) { + write_str_escaped( + formatter, + unsafe { str::from_utf8_unchecked( + &self.bytes[pos .. surrogate_pos] + )}, + )?; + write!(formatter, "\\u{{{:x}}}", surrogate)?; + pos = surrogate_pos + 3; } write_str_escaped( formatter, @@ -876,24 +875,22 @@ impl Hash for Wtf8 { } } -impl AsciiExt for Wtf8 { - type Owned = Wtf8Buf; - - fn is_ascii(&self) -> bool { +impl Wtf8 { + pub fn is_ascii(&self) -> bool { self.bytes.is_ascii() } - fn to_ascii_uppercase(&self) -> Wtf8Buf { + pub fn to_ascii_uppercase(&self) -> Wtf8Buf { Wtf8Buf { bytes: self.bytes.to_ascii_uppercase() } } - fn to_ascii_lowercase(&self) -> Wtf8Buf { + pub fn to_ascii_lowercase(&self) -> Wtf8Buf { Wtf8Buf { bytes: self.bytes.to_ascii_lowercase() } } - fn eq_ignore_ascii_case(&self, other: &Wtf8) -> bool { + pub fn eq_ignore_ascii_case(&self, other: &Wtf8) -> bool { self.bytes.eq_ignore_ascii_case(&other.bytes) } - fn make_ascii_uppercase(&mut self) { self.bytes.make_ascii_uppercase() } - fn make_ascii_lowercase(&mut self) { self.bytes.make_ascii_lowercase() } + pub fn make_ascii_uppercase(&mut self) { self.bytes.make_ascii_uppercase() } + pub fn make_ascii_lowercase(&mut self) { self.bytes.make_ascii_lowercase() } } #[cfg(test)] |