Skip to content

Commit

Permalink
Remove unneeded prelude imports in libcore tests
Browse files Browse the repository at this point in the history
These three lines are from c82da7a in
2015.

They cause problems when applying rustfmt to the codebase, because
reordering wildcard imports can trigger new unused import warnings.

As a minimized example, the following program compiles successfully:

    #![deny(unused_imports)]

    use std::fmt::Debug;
    use std::marker::Send;

    pub mod repro {
        use std::prelude::v1::*;
        use super::*;

        pub type D = dyn Debug;
        pub type S = dyn Send;
    }

    pub type S = dyn Send;

but putting it through rustfmt produces a program that fails to compile:

    #![deny(unused_imports)]

    use std::fmt::Debug;
    use std::marker::Send;

    pub mod repro {
        use super::*;
        use std::prelude::v1::*;

        pub type D = dyn Debug;
        pub type S = dyn Send;
    }

    pub type S = dyn Send;

The error is:

    error: unused import: `std::prelude::v1::*`
     --> src/main.rs:8:9
      |
    8 |     use std::prelude::v1::*;
      |         ^^^^^^^^^^^^^^^^^^^
  • Loading branch information
dtolnay committed Nov 30, 2019
1 parent 8f1bbd6 commit f34990e
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 3 deletions.
1 change: 0 additions & 1 deletion src/libcore/tests/num/bignum.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use std::prelude::v1::*;
use core::num::bignum::tests::Big8x3 as Big;

#[test]
Expand Down
1 change: 0 additions & 1 deletion src/libcore/tests/num/flt2dec/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use std::prelude::v1::*;
use std::{str, i16, f32, f64, fmt};

use core::num::flt2dec::{decode, DecodableFloat, FullDecoded, Decoded};
Expand Down
1 change: 0 additions & 1 deletion src/libcore/tests/num/flt2dec/strategy/dragon.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use std::prelude::v1::*;
use super::super::*;
use core::num::bignum::Big32x40 as Big;
use core::num::flt2dec::strategy::dragon::*;
Expand Down

0 comments on commit f34990e

Please sign in to comment.