diff options
| author | Corey Farwell <coreyf@rwell.org> | 2014-11-28 11:57:41 -0500 |
|---|---|---|
| committer | Corey Farwell <coreyf@rwell.org> | 2014-12-05 18:13:04 -0500 |
| commit | 4ef16741e355754abd446acbd80e5afb784864c7 (patch) | |
| tree | bfe4f64de5b3bcf88672424d0f66b5ad12fe7054 /src/libcore | |
| parent | 6f4c11be3b9706d1ba0e1b74b89de1478410a56f (diff) | |
| download | rust-4ef16741e355754abd446acbd80e5afb784864c7.tar.gz rust-4ef16741e355754abd446acbd80e5afb784864c7.zip | |
Utilize fewer reexports
In regards to: https://github.com/rust-lang/rust/issues/19253#issuecomment-64836729 This commit: * Changes the #deriving code so that it generates code that utilizes fewer reexports (in particur Option::* and Result::*), which is necessary to remove those reexports in the future * Changes other areas of the codebase so that fewer reexports are utilized
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/any.rs | 3 | ||||
| -rw-r--r-- | src/libcore/cell.rs | 3 | ||||
| -rw-r--r-- | src/libcore/char.rs | 3 | ||||
| -rw-r--r-- | src/libcore/cmp.rs | 10 | ||||
| -rw-r--r-- | src/libcore/fmt/float.rs | 2 | ||||
| -rw-r--r-- | src/libcore/fmt/mod.rs | 5 | ||||
| -rw-r--r-- | src/libcore/iter.rs | 23 | ||||
| -rw-r--r-- | src/libcore/num/mod.rs | 3 | ||||
| -rw-r--r-- | src/libcore/option.rs | 3 | ||||
| -rw-r--r-- | src/libcore/ptr.rs | 7 | ||||
| -rw-r--r-- | src/libcore/result.rs | 3 | ||||
| -rw-r--r-- | src/libcore/slice.rs | 9 | ||||
| -rw-r--r-- | src/libcore/str.rs | 9 | ||||
| -rw-r--r-- | src/libcore/tuple/mod.rs | 3 |
14 files changed, 54 insertions, 32 deletions
diff --git a/src/libcore/any.rs b/src/libcore/any.rs index 5d1f996831e..75feb4d8828 100644 --- a/src/libcore/any.rs +++ b/src/libcore/any.rs @@ -72,7 +72,8 @@ #![stable] use mem::{transmute}; -use option::{Option, Some, None}; +use option::Option; +use option::Option::{Some, None}; use raw::TraitObject; use intrinsics::TypeId; diff --git a/src/libcore/cell.rs b/src/libcore/cell.rs index ed4df101202..1ec2efaf801 100644 --- a/src/libcore/cell.rs +++ b/src/libcore/cell.rs @@ -160,7 +160,8 @@ use cmp::PartialEq; use default::Default; use kinds::{marker, Copy}; use ops::{Deref, DerefMut, Drop}; -use option::{None, Option, Some}; +use option::Option; +use option::Option::{None, Some}; /// A mutable memory location that admits only `Copy` data. #[unstable = "likely to be renamed; otherwise stable"] diff --git a/src/libcore/char.rs b/src/libcore/char.rs index a729596e9d2..2bebe87a14c 100644 --- a/src/libcore/char.rs +++ b/src/libcore/char.rs @@ -16,7 +16,8 @@ #![doc(primitive = "char")] use mem::transmute; -use option::{None, Option, Some}; +use option::Option; +use option::Option::{None, Some}; use iter::{range_step, Iterator, RangeStep}; use slice::SlicePrelude; diff --git a/src/libcore/cmp.rs b/src/libcore/cmp.rs index df19256471e..a5ba2b03b15 100644 --- a/src/libcore/cmp.rs +++ b/src/libcore/cmp.rs @@ -44,7 +44,8 @@ pub use self::Ordering::*; use kinds::Sized; -use option::{Option, Some, None}; +use option::Option; +use option::Option::{Some, None}; /// Trait for values that can be compared for equality and inequality. /// @@ -288,10 +289,11 @@ pub fn partial_max<T: PartialOrd>(v1: T, v2: T) -> Option<T> { // Implementation of PartialEq, Eq, PartialOrd and Ord for primitive types mod impls { - use cmp::{PartialOrd, Ord, PartialEq, Eq, Ordering, - Less, Greater, Equal}; + use cmp::{PartialOrd, Ord, PartialEq, Eq, Ordering}; + use cmp::Ordering::{Less, Greater, Equal}; use kinds::Sized; - use option::{Option, Some, None}; + use option::Option; + use option::Option::{Some, None}; macro_rules! partial_eq_impl( ($($t:ty)*) => ($( diff --git a/src/libcore/fmt/float.rs b/src/libcore/fmt/float.rs index 1e31df83779..400ce76baa0 100644 --- a/src/libcore/fmt/float.rs +++ b/src/libcore/fmt/float.rs @@ -20,7 +20,7 @@ use fmt; use iter::{range, DoubleEndedIteratorExt}; use num::{Float, FPNaN, FPInfinite, ToPrimitive}; use num::cast; -use result::Ok; +use result::Result::Ok; use slice::{mod, SlicePrelude}; use str::StrPrelude; diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs index 7b9dd70c58f..9b67cdd3e12 100644 --- a/src/libcore/fmt/mod.rs +++ b/src/libcore/fmt/mod.rs @@ -17,9 +17,10 @@ use cell::{Cell, Ref, RefMut}; use iter::{Iterator, IteratorExt, range}; use kinds::{Copy, Sized}; use mem; -use option::{Option, Some, None}; +use option::Option; +use option::Option::{Some, None}; use ops::Deref; -use result::{Ok, Err}; +use result::Result::{Ok, Err}; use result; use slice::SlicePrelude; use slice; diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index f137f43058f..49865bd3c7d 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -62,7 +62,8 @@ use cmp::Ord; use mem; use num::{ToPrimitive, Int}; use ops::{Add, Deref}; -use option::{Option, Some, None}; +use option::Option; +use option::Option::{Some, None}; use uint; #[deprecated = "renamed to Extend"] pub use self::Extend as Extendable; @@ -2458,7 +2459,9 @@ pub fn repeat<T: Clone>(elt: T) -> Repeat<T> { pub mod order { use cmp; use cmp::{Eq, Ord, PartialOrd, PartialEq}; - use option::{Option, Some, None}; + use cmp::Ordering::{Equal, Less, Greater}; + use option::Option; + use option::Option::{Some, None}; use super::Iterator; /// Compare `a` and `b` for equality using `Eq` @@ -2476,11 +2479,11 @@ pub mod order { pub fn cmp<A: Ord, T: Iterator<A>, S: Iterator<A>>(mut a: T, mut b: S) -> cmp::Ordering { loop { match (a.next(), b.next()) { - (None, None) => return cmp::Equal, - (None, _ ) => return cmp::Less, - (_ , None) => return cmp::Greater, + (None, None) => return Equal, + (None, _ ) => return Less, + (_ , None) => return Greater, (Some(x), Some(y)) => match x.cmp(&y) { - cmp::Equal => (), + Equal => (), non_eq => return non_eq, }, } @@ -2492,11 +2495,11 @@ pub mod order { -> Option<cmp::Ordering> { loop { match (a.next(), b.next()) { - (None, None) => return Some(cmp::Equal), - (None, _ ) => return Some(cmp::Less), - (_ , None) => return Some(cmp::Greater), + (None, None) => return Some(Equal), + (None, _ ) => return Some(Less), + (_ , None) => return Some(Greater), (Some(x), Some(y)) => match x.partial_cmp(&y) { - Some(cmp::Equal) => (), + Some(Equal) => (), non_eq => return non_eq, }, } diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index 748e8942a3f..e6946c83ceb 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -30,7 +30,8 @@ use kinds::Copy; use mem::size_of; use ops::{Add, Sub, Mul, Div, Rem, Neg}; use ops::{Not, BitAnd, BitOr, BitXor, Shl, Shr}; -use option::{Option, Some, None}; +use option::Option; +use option::Option::{Some, None}; use str::{FromStr, from_str, StrPrelude}; /// Simultaneous division and remainder diff --git a/src/libcore/option.rs b/src/libcore/option.rs index ef895a1d7fb..8ba41c3575f 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -149,7 +149,8 @@ use cmp::{Eq, Ord}; use default::Default; use iter::{Iterator, IteratorExt, DoubleEndedIterator, FromIterator, ExactSizeIterator}; use mem; -use result::{Result, Ok, Err}; +use result::Result; +use result::Result::{Ok, Err}; use slice; use slice::AsSlice; use clone::Clone; diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index 416bc4588b4..3f6ac49786d 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -90,9 +90,12 @@ use mem; use clone::Clone; use intrinsics; -use option::{Some, None, Option}; +use option::Option; +use option::Option::{Some, None}; -use cmp::{PartialEq, Eq, PartialOrd, Equiv, Ordering, Less, Equal, Greater}; +use cmp::{PartialEq, Eq, PartialOrd, Equiv}; +use cmp::Ordering; +use cmp::Ordering::{Less, Equal, Greater}; pub use intrinsics::copy_memory; pub use intrinsics::copy_nonoverlapping_memory; diff --git a/src/libcore/result.rs b/src/libcore/result.rs index 7c88106c9ec..0cf8e6affd7 100644 --- a/src/libcore/result.rs +++ b/src/libcore/result.rs @@ -236,7 +236,8 @@ use std::fmt::Show; use slice; use slice::AsSlice; use iter::{Iterator, IteratorExt, DoubleEndedIterator, FromIterator, ExactSizeIterator}; -use option::{None, Option, Some}; +use option::Option; +use option::Option::{None, Some}; /// `Result` is a type that represents either success (`Ok`) or failure (`Err`). /// diff --git a/src/libcore/slice.rs b/src/libcore/slice.rs index ce9f551670b..b8df36c91bc 100644 --- a/src/libcore/slice.rs +++ b/src/libcore/slice.rs @@ -36,13 +36,15 @@ use mem::transmute; use clone::Clone; -use cmp::{PartialEq, PartialOrd, Eq, Ord, Ordering, Less, Equal, Greater, Equiv}; +use cmp::{Ordering, PartialEq, PartialOrd, Eq, Ord, Equiv}; +use cmp::Ordering::{Less, Equal, Greater}; use cmp; use default::Default; use iter::*; use num::Int; use ops; -use option::{None, Option, Some}; +use option::Option; +use option::Option::{None, Some}; use ptr; use ptr::RawPtr; use mem; @@ -1702,7 +1704,8 @@ pub mod raw { use mem::transmute; use ptr::RawPtr; use raw::Slice; - use option::{None, Option, Some}; + use option::Option; + use option::Option::{None, Some}; /// Form a slice from a pointer and length (as a number of units, /// not bytes). diff --git a/src/libcore/str.rs b/src/libcore/str.rs index 4be628f0ac3..1d59567cbe4 100644 --- a/src/libcore/str.rs +++ b/src/libcore/str.rs @@ -29,7 +29,8 @@ use iter::range; use kinds::Sized; use mem; use num::Int; -use option::{Option, None, Some}; +use option::Option; +use option::Option::{None, Some}; use ptr::RawPtr; use raw::{Repr, Slice}; use slice::{mod, SlicePrelude}; @@ -1209,9 +1210,11 @@ Section: Trait implementations #[allow(missing_docs)] pub mod traits { - use cmp::{Ord, Ordering, Less, Equal, Greater, PartialEq, PartialOrd, Equiv, Eq}; + use cmp::{Ordering, Ord, PartialEq, PartialOrd, Equiv, Eq}; + use cmp::Ordering::{Less, Equal, Greater}; use iter::IteratorExt; - use option::{Option, Some}; + use option::Option; + use option::Option::Some; use ops; use str::{Str, StrPrelude, eq_slice}; diff --git a/src/libcore/tuple/mod.rs b/src/libcore/tuple/mod.rs index 56ea7a4e7a1..5ad01ae6744 100644 --- a/src/libcore/tuple/mod.rs +++ b/src/libcore/tuple/mod.rs @@ -69,7 +69,8 @@ pub use unit; use clone::Clone; use cmp::*; use default::Default; -use option::{Option, Some}; +use option::Option; +use option::Option::Some; // macro for implementing n-ary tuple functions and operations macro_rules! tuple_impls { |
