aboutsummaryrefslogtreecommitdiff
path: root/ctr-std/src/sys_common/wtf8.rs
diff options
context:
space:
mode:
authorFenrirWolf <[email protected]>2018-08-19 18:01:18 -0600
committerGitHub <[email protected]>2018-08-19 18:01:18 -0600
commit15cb3c1e91842a68a8e50e1e1a42aefab13cc25e (patch)
treea514fde042ff2a504a03305bfe0894ff8cd8d47e /ctr-std/src/sys_common/wtf8.rs
parentUpdate for latest nightly 2018-06-09 (#70) (diff)
parentUpdate for nightly-2018-08-18 (diff)
downloadctru-rs-15cb3c1e91842a68a8e50e1e1a42aefab13cc25e.tar.xz
ctru-rs-15cb3c1e91842a68a8e50e1e1a42aefab13cc25e.zip
Merge pull request #73 from FenrirWolf/update-2018-08-18
Update for nightly-2018-08-18
Diffstat (limited to 'ctr-std/src/sys_common/wtf8.rs')
-rw-r--r--ctr-std/src/sys_common/wtf8.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/ctr-std/src/sys_common/wtf8.rs b/ctr-std/src/sys_common/wtf8.rs
index 14a2555..45204b5 100644
--- a/ctr-std/src/sys_common/wtf8.rs
+++ b/ctr-std/src/sys_common/wtf8.rs
@@ -76,7 +76,7 @@ impl CodePoint {
#[inline]
pub fn from_u32(value: u32) -> Option<CodePoint> {
match value {
- 0 ... 0x10FFFF => Some(CodePoint { value: value }),
+ 0 ..= 0x10FFFF => Some(CodePoint { value: value }),
_ => None
}
}
@@ -101,7 +101,7 @@ impl CodePoint {
#[inline]
pub fn to_char(&self) -> Option<char> {
match self.value {
- 0xD800 ... 0xDFFF => None,
+ 0xD800 ..= 0xDFFF => None,
_ => Some(unsafe { char::from_u32_unchecked(self.value) })
}
}
@@ -305,7 +305,7 @@ impl Wtf8Buf {
/// like concatenating ill-formed UTF-16 strings effectively would.
#[inline]
pub fn push(&mut self, code_point: CodePoint) {
- if let trail @ 0xDC00...0xDFFF = code_point.to_u32() {
+ if let trail @ 0xDC00..=0xDFFF = code_point.to_u32() {
if let Some(lead) = (&*self).final_lead_surrogate() {
let len_without_lead_surrogate = self.len() - 3;
self.bytes.truncate(len_without_lead_surrogate);
@@ -525,7 +525,7 @@ impl Wtf8 {
#[inline]
pub fn ascii_byte_at(&self, position: usize) -> u8 {
match self.bytes[position] {
- ascii_byte @ 0x00 ... 0x7F => ascii_byte,
+ ascii_byte @ 0x00 ..= 0x7F => ascii_byte,
_ => 0xFF
}
}
@@ -630,7 +630,7 @@ impl Wtf8 {
return None
}
match &self.bytes[(len - 3)..] {
- &[0xED, b2 @ 0xA0...0xAF, b3] => Some(decode_surrogate(b2, b3)),
+ &[0xED, b2 @ 0xA0..=0xAF, b3] => Some(decode_surrogate(b2, b3)),
_ => None
}
}
@@ -642,7 +642,7 @@ impl Wtf8 {
return None
}
match &self.bytes[..3] {
- &[0xED, b2 @ 0xB0...0xBF, b3] => Some(decode_surrogate(b2, b3)),
+ &[0xED, b2 @ 0xB0..=0xBF, b3] => Some(decode_surrogate(b2, b3)),
_ => None
}
}
@@ -1245,7 +1245,7 @@ mod tests {
#[test]
fn wtf8_display() {
fn d(b: &[u8]) -> String {
- format!("{}", &unsafe { Wtf8::from_bytes_unchecked(b) })
+ (&unsafe { Wtf8::from_bytes_unchecked(b) }).to_string()
}
assert_eq!("", d("".as_bytes()));