Skip to content

Commit da57580

Browse files
Remove unused AsciiExt imports and fix tests related to ascii methods
Many AsciiExt imports have become useless thanks to the inherent ascii methods added in the last commits. These were removed. In some places, I fully specified the ascii method being called to enforce usage of the AsciiExt trait. Note that some imports are not removed but tagged with a `#[cfg(stage0)]` attribute. This is necessary, because certain ascii methods are not yet available in stage0. All those imports will be removed later. Additionally, failing tests were fixed. The test suite should exit successfully now.
1 parent 1916e3c commit da57580

File tree

12 files changed

+10
-21
lines changed

12 files changed

+10
-21
lines changed

src/liballoc/benches/str.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -272,15 +272,12 @@ make_test!(match_indices_a_str, s, s.match_indices("a").count());
272272
make_test!(split_a_str, s, s.split("a").count());
273273

274274
make_test!(trim_ascii_char, s, {
275-
use std::ascii::AsciiExt;
276275
s.trim_matches(|c: char| c.is_ascii())
277276
});
278277
make_test!(trim_left_ascii_char, s, {
279-
use std::ascii::AsciiExt;
280278
s.trim_left_matches(|c: char| c.is_ascii())
281279
});
282280
make_test!(trim_right_ascii_char, s, {
283-
use std::ascii::AsciiExt;
284281
s.trim_right_matches(|c: char| c.is_ascii())
285282
});
286283

src/liballoc/borrow.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,6 @@ impl<'a, B: ?Sized> Cow<'a, B>
191191
/// # Examples
192192
///
193193
/// ```
194-
/// use std::ascii::AsciiExt;
195194
/// use std::borrow::Cow;
196195
///
197196
/// let mut cow = Cow::Borrowed("foo");

src/liballoc/str.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -390,8 +390,6 @@ impl str {
390390
/// # Examples
391391
///
392392
/// ```
393-
/// use std::ascii::AsciiExt;
394-
///
395393
/// let mut v = String::from("hello");
396394
/// // correct length
397395
/// assert!(v.get_mut(0..5).is_some());
@@ -617,8 +615,6 @@ impl str {
617615
/// Basic usage:
618616
///
619617
/// ```
620-
/// use std::ascii::AsciiExt;
621-
///
622618
/// let mut s = "Per Martin-Löf".to_string();
623619
/// {
624620
/// let (first, last) = s.split_at_mut(3);

src/liballoc/string.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -773,8 +773,6 @@ impl String {
773773
/// Basic usage:
774774
///
775775
/// ```
776-
/// use std::ascii::AsciiExt;
777-
///
778776
/// let mut s = String::from("foobar");
779777
/// let s_mut_str = s.as_mut_str();
780778
///

src/liballoc/tests/str.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,6 @@ fn test_split_at() {
706706

707707
#[test]
708708
fn test_split_at_mut() {
709-
use std::ascii::AsciiExt;
710709
let mut s = "Hello World".to_string();
711710
{
712711
let (a, b) = s.split_at_mut(5);

src/liballoc/tests/vec.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use std::ascii::AsciiExt;
1211
use std::borrow::Cow;
1312
use std::mem::size_of;
1413
use std::panic;
@@ -966,5 +965,3 @@ fn drain_filter_complex() {
966965
assert_eq!(vec, vec![1, 3, 5, 7, 9, 11, 13, 15, 17, 19]);
967966
}
968967
}
969-
970-

src/liballoc/vec.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -853,8 +853,6 @@ impl<T> Vec<T> {
853853
/// # Examples
854854
///
855855
/// ```
856-
/// use std::ascii::AsciiExt;
857-
///
858856
/// let mut vec = vec!["foo", "bar", "Bar", "baz", "bar"];
859857
///
860858
/// vec.dedup_by(|a, b| a.eq_ignore_ascii_case(b));

src/librustc/lint/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ use hir::def_id::{CrateNum, LOCAL_CRATE};
3838
use hir::intravisit::{self, FnKind};
3939
use hir;
4040
use session::Session;
41+
#[cfg(stage0)]
4142
use std::ascii::AsciiExt;
4243
use std::hash;
4344
use syntax::ast;

src/librustdoc/clean/cfg.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use std::mem;
1616
use std::fmt::{self, Write};
1717
use std::ops;
18+
#[cfg(stage0)]
1819
use std::ascii::AsciiExt;
1920

2021
use syntax::symbol::Symbol;

src/librustdoc/html/render.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
//! both occur before the crate is rendered.
3535
pub use self::ExternalLocation::*;
3636

37+
#[cfg(stage0)]
3738
use std::ascii::AsciiExt;
3839
use std::cell::RefCell;
3940
use std::cmp::Ordering;

0 commit comments

Comments
 (0)