Skip to content

Commit 5da9e12

Browse files
committed
auto merge of #5570 : alexcrichton/rust/fix-unused-imports, r=sanxiyn
Before it wouldn't warn about unused imports in the list if something in the list was used. These commits fix that case, add a test, and remove all unused imports in lists of imports throughout the compiler.
2 parents 7f27881 + be57d74 commit 5da9e12

File tree

127 files changed

+301
-315
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+301
-315
lines changed

doc/tutorial-tasks.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ spawns the child task.
188188

189189
~~~~
190190
# use core::task::spawn;
191-
# use core::comm::{stream, Port, Chan};
191+
# use core::comm::stream;
192192
# fn some_expensive_computation() -> int { 42 }
193193
# let (port, chan) = stream();
194194
do spawn || {
@@ -208,7 +208,7 @@ computation, then waits for the child's result to arrive on the
208208
port:
209209

210210
~~~~
211-
# use core::comm::{stream, Port, Chan};
211+
# use core::comm::{stream};
212212
# fn some_other_expensive_computation() {}
213213
# let (port, chan) = stream::<int>();
214214
# chan.send(0);
@@ -277,7 +277,7 @@ might look like the example below.
277277

278278
~~~
279279
# use core::task::spawn;
280-
# use core::comm::{stream, Port, Chan};
280+
# use core::comm::stream;
281281
282282
// Create a vector of ports, one for each child task
283283
let ports = do vec::from_fn(3) |init_val| {

src/compiletest/procsrv.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use core::prelude::*;
1212

1313
use core::io::{ReaderUtil, WriterUtil};
1414
use core::io;
15-
use core::libc::{c_int, pid_t};
15+
use core::libc::c_int;
1616
use core::os;
1717
use core::run::spawn_process;
1818
use core::run;

src/libcore/cleanup.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@
1111
#[doc(hidden)];
1212

1313
use libc::{c_char, c_void, intptr_t, uintptr_t};
14-
use ptr::{mut_null, null, to_unsafe_ptr};
14+
use ptr::mut_null;
1515
use repr::BoxRepr;
1616
use sys::TypeDesc;
1717
use cast::transmute;
1818

19+
#[cfg(notest)] use ptr::to_unsafe_ptr;
20+
1921
/**
2022
* Runtime structures
2123
*

src/libcore/comm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ pub fn try_send_one<T: Owned>(chan: ChanOne<T>, data: T)
429429
430430
#[cfg(test)]
431431
pub mod test {
432-
use either::{Either, Left, Right};
432+
use either::Right;
433433
use super::{Chan, Port, oneshot, recv_one, stream};
434434
435435
#[test]

src/libcore/gc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ with destructors.
3838
*/
3939

4040
use cast;
41-
use container::{Container, Mutable, Map, Set};
41+
use container::{Map, Set};
4242
use io;
4343
use libc::{size_t, uintptr_t};
4444
use option::{None, Option, Some};

src/libcore/hash.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*/
2121

2222
use io;
23-
use io::{Writer, WriterUtil};
23+
use io::Writer;
2424
use to_bytes::IterBytes;
2525
use uint;
2626
use vec;

src/libcore/hashmap.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,7 @@ pub mod linear {
667667

668668
#[test]
669669
mod test_map {
670-
use container::{Container, Mutable, Map, Set};
670+
use container::{Container, Map, Set};
671671
use option::{None, Some};
672672
use hashmap::linear::LinearMap;
673673
use hashmap::linear;
@@ -845,7 +845,7 @@ pub mod linear {
845845
#[test]
846846
mod test_set {
847847
use hashmap::linear;
848-
use container::{Container, Mutable, Map, Set};
848+
use container::{Container, Map, Set};
849849
use vec;
850850

851851
#[test]

src/libcore/io.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use result::Result;
1818

1919
use int;
2020
use libc;
21-
use libc::{c_int, c_long, c_uint, c_void, size_t, ssize_t};
21+
use libc::{c_int, c_long, c_void, size_t, ssize_t};
2222
use libc::consts::os::posix88::*;
2323
use os;
2424
use cast;

src/libcore/num/float.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,13 @@ use f64;
2424
use num::NumCast;
2525
use num::strconv;
2626
use num;
27-
use option::{None, Option, Some};
27+
use option::Option;
2828
use to_str;
2929
use from_str;
3030

3131
#[cfg(notest)] use cmp::{Eq, Ord};
3232
#[cfg(notest)] use ops;
33+
#[cfg(test)] use option::{Some, None};
3334

3435
pub use f64::{add, sub, mul, div, rem, lt, le, eq, ne, ge, gt};
3536
pub use f64::logarithm;

src/libcore/num/num.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
// except according to those terms.
1010

1111
//! An interface for numeric types
12-
use cmp::{Ord, Eq};
13-
use ops::{Add, Div, Modulo, Mul, Neg, Sub};
14-
use option::{None, Option, Some};
12+
use cmp::Ord;
13+
use ops::{Div, Mul, Neg};
14+
use option::Option;
1515
use kinds::Copy;
1616

1717
pub mod strconv;

0 commit comments

Comments
 (0)