Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions src/librustc_unicode/char.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@

use core::char::CharExt as C;
use core::fmt;
use tables::{derived_property, property, general_category, conversions};
use tables::{conversions, derived_property, general_category, property};

// stable reexports
#[stable(feature = "rust1", since = "1.0.0")]
pub use core::char::{MAX, from_u32, from_u32_unchecked, from_digit};
pub use core::char::{MAX, from_digit, from_u32, from_u32_unchecked};
#[stable(feature = "rust1", since = "1.0.0")]
pub use core::char::{EscapeUnicode, EscapeDefault, EncodeUtf8, EncodeUtf16};
pub use core::char::{EncodeUtf16, EncodeUtf8, EscapeDefault, EscapeUnicode};

// unstable reexports
#[unstable(feature = "unicode", issue = "27783")]
Expand Down Expand Up @@ -808,16 +808,18 @@ pub fn decode_utf16<I: IntoIterator<Item = u16>>(iter: I) -> DecodeUtf16<I::Into
}

#[stable(feature = "decode_utf16", since = "1.9.0")]
impl<I: Iterator<Item=u16>> Iterator for DecodeUtf16<I> {
impl<I: Iterator<Item = u16>> Iterator for DecodeUtf16<I> {
type Item = Result<char, DecodeUtf16Error>;

fn next(&mut self) -> Option<Result<char, DecodeUtf16Error>> {
let u = match self.buf.take() {
Some(buf) => buf,
None => match self.iter.next() {
Some(u) => u,
None => return None,
},
None => {
match self.iter.next() {
Some(u) => u,
None => return None,
}
}
};

if u < 0xD800 || 0xDFFF < u {
Expand Down
8 changes: 4 additions & 4 deletions src/librustc_unicode/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ pub mod char;

#[allow(deprecated)]
pub mod str {
pub use u_str::{UnicodeStr, SplitWhitespace};
pub use u_str::{utf8_char_width, is_utf16};
pub use u_str::{Utf16Encoder};
pub use u_str::{SplitWhitespace, UnicodeStr};
pub use u_str::{is_utf16, utf8_char_width};
pub use u_str::Utf16Encoder;
}

// For use in libcollections, not re-exported in libstd.
pub mod derived_property {
pub use tables::derived_property::{Cased, Case_Ignorable};
pub use tables::derived_property::{Case_Ignorable, Cased};
}

// For use in libsyntax
Expand Down
4 changes: 3 additions & 1 deletion src/librustc_unicode/u_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@ impl<I> Utf16Encoder<I> {
}
}

impl<I> Iterator for Utf16Encoder<I> where I: Iterator<Item=char> {
impl<I> Iterator for Utf16Encoder<I>
where I: Iterator<Item = char>
{
type Item = u16;

#[inline]
Expand Down