make_test!(split_a_str, s, s.split("a").count());
make_test!(trim_ascii_char, s, {
- use std::ascii::AsciiExt;
s.trim_matches(|c: char| c.is_ascii())
});
make_test!(trim_left_ascii_char, s, {
- use std::ascii::AsciiExt;
s.trim_left_matches(|c: char| c.is_ascii())
});
make_test!(trim_right_ascii_char, s, {
- use std::ascii::AsciiExt;
s.trim_right_matches(|c: char| c.is_ascii())
});
/// # Examples
///
/// ```
- /// use std::ascii::AsciiExt;
/// use std::borrow::Cow;
///
/// let mut cow = Cow::Borrowed("foo");
/// # Examples
///
/// ```
- /// use std::ascii::AsciiExt;
- ///
/// let mut v = String::from("hello");
/// // correct length
/// assert!(v.get_mut(0..5).is_some());
/// Basic usage:
///
/// ```
- /// use std::ascii::AsciiExt;
- ///
/// let mut s = "Per Martin-Löf".to_string();
/// {
/// let (first, last) = s.split_at_mut(3);
/// Basic usage:
///
/// ```
- /// use std::ascii::AsciiExt;
- ///
/// let mut s = String::from("foobar");
/// let s_mut_str = s.as_mut_str();
///
#[test]
fn test_split_at_mut() {
- use std::ascii::AsciiExt;
let mut s = "Hello World".to_string();
{
let (a, b) = s.split_at_mut(5);
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::ascii::AsciiExt;
use std::borrow::Cow;
use std::mem::size_of;
use std::panic;
assert_eq!(vec, vec![1, 3, 5, 7, 9, 11, 13, 15, 17, 19]);
}
}
-
-
/// # Examples
///
/// ```
- /// use std::ascii::AsciiExt;
- ///
/// let mut vec = vec!["foo", "bar", "Bar", "baz", "bar"];
///
/// vec.dedup_by(|a, b| a.eq_ignore_ascii_case(b));
use hir::intravisit::{self, FnKind};
use hir;
use session::Session;
+#[cfg(stage0)]
use std::ascii::AsciiExt;
use std::hash;
use syntax::ast;
use std::mem;
use std::fmt::{self, Write};
use std::ops;
+#[cfg(stage0)]
use std::ascii::AsciiExt;
use syntax::symbol::Symbol;
//! both occur before the crate is rendered.
pub use self::ExternalLocation::*;
+#[cfg(stage0)]
use std::ascii::AsciiExt;
use std::cell::RefCell;
use std::cmp::Ordering;
/// ```
/// use std::ascii::AsciiExt;
///
-/// assert_eq!("café".to_ascii_uppercase(), "CAFÉ");
-/// assert_eq!("café".to_ascii_uppercase(), "CAFé");
+/// assert_eq!(AsciiExt::to_ascii_uppercase("café"), "CAFÉ");
+/// assert_eq!(AsciiExt::to_ascii_uppercase("café"), "CAFé");
/// ```
///
/// In the first example, the lowercased string is represented `"cafe\u{301}"`
#[cfg(test)]
mod tests {
- use super::*;
+ //! Note that most of these tests are not testing `AsciiExt` methods, but
+ //! test inherent ascii methods of char, u8, str and [u8]. `AsciiExt` is
+ //! just using those methods, though.
use char::from_u32;
#[test]
- .escape_debug()
- .escape_default()
- .escape_unicode()
- - .to_lowercase()
- - .to_uppercase()
+ - .to_ascii_lowercase()
+ - .to_ascii_uppercase()
error[E0308]: mismatched types
--> $DIR/deref-suggestion.rs:23:10