diff --git a/src/doc/reference.md b/src/doc/reference.md index 1d27ac096df8a..9b74751fc0d3b 100644 --- a/src/doc/reference.md +++ b/src/doc/reference.md @@ -994,7 +994,7 @@ An example of `use` declarations: ``` use std::iter::range_step; -use std::option::{Some, None}; +use std::option::Option::{Some, None}; use std::collections::hash_map::{mod, HashMap}; fn foo(_: T){} @@ -1004,8 +1004,8 @@ fn main() { // Equivalent to 'std::iter::range_step(0u, 10u, 2u);' range_step(0u, 10u, 2u); - // Equivalent to 'foo(vec![std::option::Some(1.0f64), - // std::option::None]);' + // Equivalent to 'foo(vec![std::option::Option::Some(1.0f64), + // std::option::Option::None]);' foo(vec![Some(1.0f64), None]); // Both `hash_map` and `HashMap` are in scope. diff --git a/src/etc/unicode.py b/src/etc/unicode.py index 15263919fb9b8..20edf9418f148 100755 --- a/src/etc/unicode.py +++ b/src/etc/unicode.py @@ -292,7 +292,7 @@ def escape_char(c): def emit_bsearch_range_table(f): f.write(""" fn bsearch_range_table(c: char, r: &'static [(char,char)]) -> bool { - use core::cmp::{Equal, Less, Greater}; + use core::cmp::Ordering::{Equal, Less, Greater}; use core::slice::SlicePrelude; r.binary_search(|&(lo,hi)| { if lo <= c && c <= hi { Equal } @@ -350,10 +350,11 @@ def emit_regex_module(f, cats, w_data): def emit_conversions_module(f, lowerupper, upperlower): f.write("pub mod conversions {") f.write(""" - use core::cmp::{Equal, Less, Greater}; + use core::cmp::Ordering::{Equal, Less, Greater}; use core::slice::SlicePrelude; use core::tuple::Tuple2; - use core::option::{Option, Some, None}; + use core::option::Option; + use core::option::Option::{Some, None}; use core::slice; pub fn to_lower(c: char) -> char { @@ -403,7 +404,7 @@ def emit_grapheme_module(f, grapheme_table, grapheme_cats): f.write(""" } fn bsearch_range_value_table(c: char, r: &'static [(char, char, GraphemeCat)]) -> GraphemeCat { - use core::cmp::{Equal, Less, Greater}; + use core::cmp::Ordering::{Equal, Less, Greater}; match r.binary_search(|&(lo, hi, _)| { if lo <= c && c <= hi { Equal } else if hi < c { Less } @@ -430,12 +431,13 @@ def emit_grapheme_module(f, grapheme_table, grapheme_cats): def emit_charwidth_module(f, width_table): f.write("pub mod charwidth {\n") - f.write(" use core::option::{Option, Some, None};\n") + f.write(" use core::option::Option;\n") + f.write(" use core::option::Option::{Some, None};\n") f.write(" use core::slice::SlicePrelude;\n") f.write(" use core::slice;\n") f.write(""" fn bsearch_range_value_table(c: char, is_cjk: bool, r: &'static [(char, char, u8, u8)]) -> u8 { - use core::cmp::{Equal, Less, Greater}; + use core::cmp::Ordering::{Equal, Less, Greater}; match r.binary_search(|&(lo, hi, _, _)| { if lo <= c && c <= hi { Equal } else if hi < c { Less } @@ -530,7 +532,7 @@ def comp_pfun(char): f.write(""" fn bsearch_range_value_table(c: char, r: &'static [(char, char, u8)]) -> u8 { - use core::cmp::{Equal, Less, Greater}; + use core::cmp::Ordering::{Equal, Less, Greater}; use core::slice::SlicePrelude; use core::slice; match r.binary_search(|&(lo, hi, _)| { diff --git a/src/liballoc/arc.rs b/src/liballoc/arc.rs index 4f744b0b2dee1..ef05279e825ea 100644 --- a/src/liballoc/arc.rs +++ b/src/liballoc/arc.rs @@ -22,7 +22,8 @@ use core::kinds::{Sync, Send}; use core::mem::{min_align_of, size_of, drop}; use core::mem; use core::ops::{Drop, Deref}; -use core::option::{Some, None, Option}; +use core::option::Option; +use core::option::Option::{Some, None}; use core::ptr::RawPtr; use core::ptr; use heap::deallocate; @@ -326,7 +327,8 @@ mod tests { use std::comm::channel; use std::mem::drop; use std::ops::Drop; - use std::option::{Option, Some, None}; + use std::option::Option; + use std::option::Option::{Some, None}; use std::str::Str; use std::sync::atomic; use std::task; diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index 000dda59e3dda..eb483498998c5 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -19,7 +19,8 @@ use core::kinds::Sized; use core::mem; use core::option::Option; use core::raw::TraitObject; -use core::result::{Ok, Err, Result}; +use core::result::Result; +use core::result::Result::{Ok, Err}; /// A value that represents the global exchange heap. This is the default /// place that the `box` keyword allocates into when no place is supplied. diff --git a/src/liballoc/heap.rs b/src/liballoc/heap.rs index 579f47ee87466..06605bfff215c 100644 --- a/src/liballoc/heap.rs +++ b/src/liballoc/heap.rs @@ -125,7 +125,8 @@ const MIN_ALIGN: uint = 16; #[cfg(jemalloc)] mod imp { - use core::option::{None, Option}; + use core::option::Option; + use core::option::Option::None; use core::ptr::{null_mut, null}; use core::num::Int; use libc::{c_char, c_int, c_void, size_t}; diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index e626d63937bc2..53891583edb20 100644 --- a/src/liballoc/rc.rs +++ b/src/liballoc/rc.rs @@ -149,10 +149,12 @@ use core::fmt; use core::kinds::marker; use core::mem::{transmute, min_align_of, size_of, forget}; use core::ops::{Deref, Drop}; -use core::option::{Option, Some, None}; +use core::option::Option; +use core::option::Option::{Some, None}; use core::ptr; use core::ptr::RawPtr; -use core::result::{Result, Ok, Err}; +use core::result::Result; +use core::result::Result::{Ok, Err}; use heap::deallocate; @@ -739,8 +741,9 @@ impl RcBoxPtr for Weak { mod tests { use super::{Rc, Weak, weak_count, strong_count}; use std::cell::RefCell; - use std::option::{Option, Some, None}; - use std::result::{Err, Ok}; + use std::option::Option; + use std::option::Option::{Some, None}; + use std::result::Result::{Err, Ok}; use std::mem::drop; use std::clone::Clone; diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs index c6fa1332186ec..a6d45522e472e 100644 --- a/src/libcollections/str.rs +++ b/src/libcollections/str.rs @@ -832,8 +832,10 @@ mod tests { use std::default::Default; use std::char::Char; use std::clone::Clone; - use std::cmp::{Equal, Greater, Less, Ord, PartialOrd, Equiv}; - use std::option::{Some, None}; + use std::cmp::{Ord, PartialOrd, Equiv}; + use std::cmp::Ordering::{Equal, Greater, Less}; + use std::option::Option; + use std::option::Option::{Some, None}; use std::ptr::RawPtr; use std::iter::{Iterator, IteratorExt, DoubleEndedIteratorExt}; diff --git a/src/libcore/any.rs b/src/libcore/any.rs index 5d1f996831e5b..75feb4d88289e 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 587bb4cb110e1..1863ec2c75b86 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 a729596e9d290..2bebe87a14ce4 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 51122d0a17023..2a38b0e3b127a 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(v1: T, v2: T) -> Option { // 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 1e31df8377942..400ce76baa0d2 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 1d6906c13a8fa..43819501aa5cd 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 2d488a4b15563..8a93d4917bdec 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; @@ -2427,7 +2428,9 @@ pub fn repeat(elt: T) -> Repeat { 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` @@ -2445,11 +2448,11 @@ pub mod order { pub fn cmp, S: Iterator>(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, }, } @@ -2461,11 +2464,11 @@ pub mod order { -> Option { 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 ce61bd97e1323..6a6627f27a696 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 7d7b41bf7bfd8..7a6f7bf8ce724 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 5e2f5529e8d49..0b01ff830776b 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 202ac46449754..b73b45de2504d 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 950f04a5d97e3..1ea6e5b14a729 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 b9586399aec5d..98d04f1ae0b2f 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 56ea7a4e7a1e9..5ad01ae67442e 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 { diff --git a/src/libcoretest/num/mod.rs b/src/libcoretest/num/mod.rs index 0cd1ded21d6c6..6ee3633d36c14 100644 --- a/src/libcoretest/num/mod.rs +++ b/src/libcoretest/num/mod.rs @@ -48,7 +48,8 @@ pub fn test_num(ten: T, two: T) where #[cfg(test)] mod test { - use core::option::{Option, Some, None}; + use core::option::Option; + use core::option::Option::{Some, None}; use core::num::Float; use core::num::from_str_radix; diff --git a/src/libgetopts/lib.rs b/src/libgetopts/lib.rs index 1204ac18f99dc..e146e3c76eb2f 100644 --- a/src/libgetopts/lib.rs +++ b/src/libgetopts/lib.rs @@ -99,7 +99,7 @@ use self::Fail::*; use self::Optval::*; use std::fmt; -use std::result::{Err, Ok}; +use std::result::Result::{Err, Ok}; use std::result; use std::string::String; @@ -951,7 +951,7 @@ mod tests { use super::*; use super::Fail::*; - use std::result::{Err, Ok}; + use std::result::Result::{Err, Ok}; use std::result; // Tests for reqopt @@ -1392,8 +1392,8 @@ mod tests { let args_single = vec!("-e".to_string(), "foo".to_string()); let matches_single = &match getopts(args_single.as_slice(), opts.as_slice()) { - result::Ok(m) => m, - result::Err(_) => panic!() + result::Result::Ok(m) => m, + result::Result::Err(_) => panic!() }; assert!(matches_single.opts_present(&["e".to_string()])); assert!(matches_single.opts_present(&["encrypt".to_string(), "e".to_string()])); @@ -1412,8 +1412,8 @@ mod tests { "foo".to_string()); let matches_both = &match getopts(args_both.as_slice(), opts.as_slice()) { - result::Ok(m) => m, - result::Err(_) => panic!() + result::Result::Ok(m) => m, + result::Result::Err(_) => panic!() }; assert!(matches_both.opts_present(&["e".to_string()])); assert!(matches_both.opts_present(&["encrypt".to_string()])); @@ -1437,8 +1437,8 @@ mod tests { let opts = vec!(optmulti("L", "", "library directory", "LIB"), optmulti("M", "", "something", "MMMM")); let matches = &match getopts(args.as_slice(), opts.as_slice()) { - result::Ok(m) => m, - result::Err(_) => panic!() + result::Result::Ok(m) => m, + result::Result::Err(_) => panic!() }; assert!(matches.opts_present(&["L".to_string()])); assert_eq!(matches.opts_str(&["L".to_string()]).unwrap(), "foo".to_string()); @@ -1453,8 +1453,8 @@ mod tests { let opts = vec!(optmulti("L", "", "library directory", "LIB"), optflagmulti("v", "verbose", "Verbose")); let matches = &match getopts(args.as_slice(), opts.as_slice()) { - result::Ok(m) => m, - result::Err(e) => panic!( "{}", e ) + result::Result::Ok(m) => m, + result::Result::Err(e) => panic!( "{}", e ) }; assert!(matches.opts_present(&["L".to_string()])); assert_eq!(matches.opts_str(&["L".to_string()]).unwrap(), "verbose".to_string()); diff --git a/src/librbml/lib.rs b/src/librbml/lib.rs index 6f3fbe1251008..f65c4f4e3edcc 100644 --- a/src/librbml/lib.rs +++ b/src/librbml/lib.rs @@ -120,7 +120,8 @@ pub mod reader { use std::io::extensions::u64_from_be_bytes; use std::mem::transmute; use std::num::Int; - use std::option::{None, Option, Some}; + use std::option::Option; + use std::option::Option::{None, Some}; use serialize; @@ -1060,7 +1061,8 @@ mod tests { use serialize::{Encodable, Decodable}; - use std::option::{None, Option, Some}; + use std::option::Option; + use std::option::Option::{None, Some}; #[test] fn test_vuint_at() { diff --git a/src/librustc/middle/typeck/check/demand.rs b/src/librustc/middle/typeck/check/demand.rs index 1e45d059b849b..eaef3c13afd78 100644 --- a/src/librustc/middle/typeck/check/demand.rs +++ b/src/librustc/middle/typeck/check/demand.rs @@ -15,8 +15,7 @@ use middle::typeck::infer; use middle::typeck::infer::resolve_type; use middle::typeck::infer::resolve::try_resolve_tvar_shallow; -use std::result::{Err, Ok}; -use std::result; +use std::result::Result::{Err, Ok}; use syntax::ast; use syntax::codemap::Span; use util::ppaux::Repr; @@ -44,8 +43,8 @@ pub fn suptype_with_fn<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>, // n.b.: order of actual, expected is reversed match infer::mk_subty(fcx.infcx(), b_is_expected, infer::Misc(sp), ty_b, ty_a) { - result::Ok(()) => { /* ok */ } - result::Err(ref err) => { + Ok(()) => { /* ok */ } + Err(ref err) => { handle_err(sp, ty_a, ty_b, err); } } @@ -75,8 +74,8 @@ pub fn coerce<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>, sp: Span, try_resolve_tvar_shallow).unwrap_or(expected) } else { expected }; match fcx.mk_assignty(expr, expr_ty, expected) { - result::Ok(()) => { /* ok */ } - result::Err(ref err) => { + Ok(()) => { /* ok */ } + Err(ref err) => { fcx.report_mismatched_types(sp, expected, expr_ty, err); } } diff --git a/src/librustc_trans/trans/cabi.rs b/src/librustc_trans/trans/cabi.rs index 0214bf29eeeb9..518b0ba73f8b7 100644 --- a/src/librustc_trans/trans/cabi.rs +++ b/src/librustc_trans/trans/cabi.rs @@ -65,8 +65,8 @@ impl ArgType { ArgType { kind: Indirect, ty: ty, - cast: option::None, - pad: option::None, + cast: option::Option::None, + pad: option::Option::None, attr: attr } } diff --git a/src/libstd/ascii.rs b/src/libstd/ascii.rs index 403ca9d14321a..8fc3c23e88f15 100644 --- a/src/libstd/ascii.rs +++ b/src/libstd/ascii.rs @@ -19,7 +19,8 @@ use core::kinds::Sized; use fmt; use iter::IteratorExt; use mem; -use option::{Option, Some, None}; +use option::Option; +use option::Option::{Some, None}; use slice::{SlicePrelude, AsSlice}; use str::{Str, StrPrelude}; use string::{String, IntoString}; diff --git a/src/libstd/bitflags.rs b/src/libstd/bitflags.rs index d8023dd3e4e3b..8a90c06f0385c 100644 --- a/src/libstd/bitflags.rs +++ b/src/libstd/bitflags.rs @@ -149,9 +149,9 @@ macro_rules! bitflags { #[inline] pub fn from_bits(bits: $T) -> ::std::option::Option<$BitFlags> { if (bits & !$BitFlags::all().bits()) != 0 { - ::std::option::None + ::std::option::Option::None } else { - ::std::option::Some($BitFlags { bits: bits }) + ::std::option::Option::Some($BitFlags { bits: bits }) } } @@ -261,7 +261,7 @@ macro_rules! bitflags { #[allow(non_upper_case_globals)] mod tests { use hash; - use option::{Some, None}; + use option::Option::{Some, None}; use ops::{BitOr, BitAnd, BitXor, Sub, Not}; bitflags! { diff --git a/src/libstd/c_vec.rs b/src/libstd/c_vec.rs index 1f94d7b4fa611..f89876f7245e6 100644 --- a/src/libstd/c_vec.rs +++ b/src/libstd/c_vec.rs @@ -38,7 +38,8 @@ use kinds::Send; use mem; use ops::Drop; -use option::{Option, Some, None}; +use option::Option; +use option::Option::{Some, None}; use ptr::RawPtr; use ptr; use raw; diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs index 50a00714ea06c..e8e42fd295dea 100644 --- a/src/libstd/collections/hash/map.rs +++ b/src/libstd/collections/hash/map.rs @@ -25,8 +25,10 @@ use kinds::Sized; use mem::{mod, replace}; use num::UnsignedInt; use ops::{Deref, Index, IndexMut}; -use option::{Some, None, Option}; -use result::{Result, Ok, Err}; +use option::Option; +use option::Option::{Some, None}; +use result::Result; +use result::Result::{Ok, Err}; use super::table; use super::table::{ diff --git a/src/libstd/collections/hash/set.rs b/src/libstd/collections/hash/set.rs index f6d526cca395d..f7e5e2796638e 100644 --- a/src/libstd/collections/hash/set.rs +++ b/src/libstd/collections/hash/set.rs @@ -19,8 +19,8 @@ use fmt; use hash::{Hash, Hasher, RandomSipHasher}; use iter::{Iterator, IteratorExt, FromIterator, FilterMap, Chain, Repeat, Zip, Extend, repeat}; use iter; -use option::{Some, None}; -use result::{Ok, Err}; +use option::Option::{Some, None}; +use result::Result::{Ok, Err}; use super::map::{HashMap, Entries, MoveEntries, INITIAL_CAPACITY}; diff --git a/src/libstd/collections/hash/table.rs b/src/libstd/collections/hash/table.rs index f41ccea0aaf03..de06a1e0bbd6e 100644 --- a/src/libstd/collections/hash/table.rs +++ b/src/libstd/collections/hash/table.rs @@ -21,7 +21,8 @@ use mem::{min_align_of, size_of}; use mem; use num::{Int, UnsignedInt}; use ops::{Deref, DerefMut, Drop}; -use option::{Some, None, Option}; +use option::Option; +use option::Option::{Some, None}; use ptr::{RawPtr, copy_nonoverlapping_memory, zero_memory}; use ptr; use rt::heap::{allocate, deallocate}; diff --git a/src/libstd/collections/lru_cache.rs b/src/libstd/collections/lru_cache.rs index 94bea37d18728..adbc135364be7 100644 --- a/src/libstd/collections/lru_cache.rs +++ b/src/libstd/collections/lru_cache.rs @@ -44,10 +44,11 @@ use hash::Hash; use iter::{range, Iterator, Extend}; use mem; use ops::Drop; -use option::{Some, None, Option}; +use option::Option; +use option::Option::{Some, None}; use boxed::Box; use ptr; -use result::{Ok, Err}; +use result::Result::{Ok, Err}; // FIXME(conventions): implement iterators? // FIXME(conventions): implement indexing? diff --git a/src/libstd/dynamic_lib.rs b/src/libstd/dynamic_lib.rs index 3cd0c0eeaf290..b40990addddfb 100644 --- a/src/libstd/dynamic_lib.rs +++ b/src/libstd/dynamic_lib.rs @@ -280,7 +280,8 @@ pub mod dl { use libc; use os; use ptr; - use result::{Ok, Err, Result}; + use result::Result; + use result::Result::{Ok, Err}; use slice::SlicePrelude; use str::StrPrelude; use str; diff --git a/src/libstd/error.rs b/src/libstd/error.rs index 82ad893f88a1a..9ad2655f6e9db 100644 --- a/src/libstd/error.rs +++ b/src/libstd/error.rs @@ -78,7 +78,8 @@ //! } //! ``` -use option::{Option, None}; +use option::Option; +use option::Option::None; use kinds::Send; use string::String; diff --git a/src/libstd/failure.rs b/src/libstd/failure.rs index d839c1484e562..58a41f4d7d5a1 100644 --- a/src/libstd/failure.rs +++ b/src/libstd/failure.rs @@ -16,8 +16,9 @@ use cell::RefCell; use fmt; use io::{Writer, IoResult}; use kinds::Send; -use option::{Some, None, Option}; -use result::Ok; +use option::Option; +use option::Option::{Some, None}; +use result::Result::Ok; use rt::backtrace; use rustrt::{Stderr, Stdio}; use rustrt::local::Local; diff --git a/src/libstd/fmt.rs b/src/libstd/fmt.rs index 7e1bfd704a927..6a2047d1cef30 100644 --- a/src/libstd/fmt.rs +++ b/src/libstd/fmt.rs @@ -406,7 +406,7 @@ use io::Writer; use io; -use result::{Ok, Err}; +use result::Result::{Ok, Err}; use string; use vec::Vec; diff --git a/src/libstd/io/buffered.rs b/src/libstd/io/buffered.rs index e92bad592d126..0155608fc6674 100644 --- a/src/libstd/io/buffered.rs +++ b/src/libstd/io/buffered.rs @@ -16,8 +16,9 @@ use cmp; use io::{Reader, Writer, Stream, Buffer, DEFAULT_BUF_SIZE, IoResult}; use iter::ExactSizeIterator; use ops::Drop; -use option::{Some, None, Option}; -use result::{Ok, Err}; +use option::Option; +use option::Option::{Some, None}; +use result::Result::{Ok, Err}; use slice::{SlicePrelude}; use slice; use vec::Vec; diff --git a/src/libstd/io/comm_adapters.rs b/src/libstd/io/comm_adapters.rs index a90b6bbbb8e8e..3de0a7be95e8b 100644 --- a/src/libstd/io/comm_adapters.rs +++ b/src/libstd/io/comm_adapters.rs @@ -12,8 +12,8 @@ use clone::Clone; use cmp; use comm::{Sender, Receiver}; use io; -use option::{None, Some}; -use result::{Ok, Err}; +use option::Option::{None, Some}; +use result::Result::{Ok, Err}; use slice::{bytes, CloneSliceAllocPrelude, SlicePrelude}; use super::{Buffer, Reader, Writer, IoResult}; use vec::Vec; diff --git a/src/libstd/io/extensions.rs b/src/libstd/io/extensions.rs index 4b2ffb4d559c4..1bdf99f6d6dce 100644 --- a/src/libstd/io/extensions.rs +++ b/src/libstd/io/extensions.rs @@ -19,9 +19,10 @@ use io::{IoError, IoResult, Reader}; use io; use iter::Iterator; use num::Int; -use option::{Option, Some, None}; +use option::Option; +use option::Option::{Some, None}; use ptr::RawPtr; -use result::{Ok, Err}; +use result::Result::{Ok, Err}; use slice::{SlicePrelude, AsSlice}; /// An iterator that reads a single byte on each iteration, diff --git a/src/libstd/io/fs.rs b/src/libstd/io/fs.rs index bd334f52628fe..7bff4ec5ce623 100644 --- a/src/libstd/io/fs.rs +++ b/src/libstd/io/fs.rs @@ -58,10 +58,11 @@ use io::{Read, Truncate, ReadWrite, Append}; use io::UpdateIoError; use io; use iter::{Iterator, Extend}; -use option::{Some, None, Option}; +use option::Option; +use option::Option::{Some, None}; use path::{Path, GenericPath}; use path; -use result::{Err, Ok}; +use result::Result::{Err, Ok}; use slice::SlicePrelude; use string::String; use vec::Vec; diff --git a/src/libstd/io/mem.rs b/src/libstd/io/mem.rs index f27951f263da2..63b3ceb56ee4d 100644 --- a/src/libstd/io/mem.rs +++ b/src/libstd/io/mem.rs @@ -15,8 +15,8 @@ #![allow(deprecated)] use cmp::min; -use option::None; -use result::{Err, Ok}; +use option::Option::None; +use result::Result::{Err, Ok}; use io; use io::{Reader, Writer, Seek, Buffer, IoError, SeekStyle, IoResult}; use slice::{mod, AsSlice, SlicePrelude}; diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs index 5ed10eab15b80..9d5aa648cb003 100644 --- a/src/libstd/io/mod.rs +++ b/src/libstd/io/mod.rs @@ -233,10 +233,12 @@ use int; use iter::{Iterator, IteratorExt}; use mem::transmute; use ops::{BitOr, BitXor, BitAnd, Sub, Not}; -use option::{Option, Some, None}; +use option::Option; +use option::Option::{Some, None}; use os; use boxed::Box; -use result::{Ok, Err, Result}; +use result::Result; +use result::Result::{Ok, Err}; use sys; use slice::{AsSlice, SlicePrelude}; use str::{Str, StrPrelude}; diff --git a/src/libstd/io/net/addrinfo.rs b/src/libstd/io/net/addrinfo.rs index 7de7869213091..fea8372733c29 100644 --- a/src/libstd/io/net/addrinfo.rs +++ b/src/libstd/io/net/addrinfo.rs @@ -22,7 +22,8 @@ pub use self::Protocol::*; use iter::IteratorExt; use io::{IoResult}; use io::net::ip::{SocketAddr, IpAddr}; -use option::{Option, Some, None}; +use option::Option; +use option::Option::{Some, None}; use sys; use vec::Vec; diff --git a/src/libstd/io/net/ip.rs b/src/libstd/io/net/ip.rs index 4812e911cc481..9c0fbbe274b3e 100644 --- a/src/libstd/io/net/ip.rs +++ b/src/libstd/io/net/ip.rs @@ -21,8 +21,9 @@ use fmt; use io::{mod, IoResult, IoError}; use io::net; use iter::{Iterator, IteratorExt}; -use option::{Option, None, Some}; -use result::{Ok, Err}; +use option::Option; +use option::Option::{None, Some}; +use result::Result::{Ok, Err}; use str::{FromStr, StrPrelude}; use slice::{CloneSlicePrelude, SlicePrelude}; use vec::Vec; diff --git a/src/libstd/io/net/mod.rs b/src/libstd/io/net/mod.rs index 5b1747876d7e0..09e5639bea944 100644 --- a/src/libstd/io/net/mod.rs +++ b/src/libstd/io/net/mod.rs @@ -11,8 +11,8 @@ //! Networking I/O use io::{IoError, IoResult, InvalidInput}; -use option::None; -use result::{Ok, Err}; +use option::Option::None; +use result::Result::{Ok, Err}; use self::ip::{SocketAddr, ToSocketAddr}; pub use self::addrinfo::get_host_addresses; diff --git a/src/libstd/io/net/tcp.rs b/src/libstd/io/net/tcp.rs index aa2234175917c..a7b1b077eff0b 100644 --- a/src/libstd/io/net/tcp.rs +++ b/src/libstd/io/net/tcp.rs @@ -19,11 +19,12 @@ use clone::Clone; use io::IoResult; -use result::Err; +use result::Result::Err; use io::net::ip::{SocketAddr, ToSocketAddr}; use io::{Reader, Writer, Listener, Acceptor}; use io::{standard_error, TimedOut}; -use option::{None, Some, Option}; +use option::Option; +use option::Option::{None, Some}; use time::Duration; use sys::tcp::TcpStream as TcpStreamImp; diff --git a/src/libstd/io/net/udp.rs b/src/libstd/io/net/udp.rs index a7239ca0f2f98..a2ad365dd2a0e 100644 --- a/src/libstd/io/net/udp.rs +++ b/src/libstd/io/net/udp.rs @@ -19,7 +19,7 @@ use clone::Clone; use io::net::ip::{SocketAddr, IpAddr, ToSocketAddr}; use io::{Reader, Writer, IoResult}; use option::Option; -use result::{Ok, Err}; +use result::Result::{Ok, Err}; use sys::udp::UdpSocket as UdpSocketImp; use sys_common; diff --git a/src/libstd/io/result.rs b/src/libstd/io/result.rs index 305bcf9ecbc9c..32965d23971ed 100644 --- a/src/libstd/io/result.rs +++ b/src/libstd/io/result.rs @@ -15,7 +15,7 @@ //! as a `Reader` without unwrapping the result first. use clone::Clone; -use result::{Ok, Err}; +use result::Result::{Ok, Err}; use super::{Reader, Writer, Listener, Acceptor, Seek, SeekStyle, IoResult}; impl Writer for IoResult { diff --git a/src/libstd/io/stdio.rs b/src/libstd/io/stdio.rs index 665000eae8837..74525785dc93b 100644 --- a/src/libstd/io/stdio.rs +++ b/src/libstd/io/stdio.rs @@ -36,8 +36,9 @@ use io::{Reader, Writer, IoResult, IoError, OtherIoError, use kinds::Send; use libc; use mem; -use option::{Option, Some, None}; -use result::{Ok, Err}; +use option::Option; +use option::Option::{Some, None}; +use result::Result::{Ok, Err}; use rustrt; use rustrt::local::Local; use rustrt::task::Task; diff --git a/src/libstd/io/tempfile.rs b/src/libstd/io/tempfile.rs index 4788ba79b7fa8..f3a119399952d 100644 --- a/src/libstd/io/tempfile.rs +++ b/src/libstd/io/tempfile.rs @@ -14,10 +14,11 @@ use io::{fs, IoResult}; use io; use libc; use ops::Drop; -use option::{Option, None, Some}; +use option::Option; +use option::Option::{None, Some}; use os; use path::{Path, GenericPath}; -use result::{Ok, Err}; +use result::Result::{Ok, Err}; use sync::atomic; /// A wrapper for a path to temporary directory implementing automatic diff --git a/src/libstd/os.rs b/src/libstd/os.rs index 90203709627ff..9fae261a0fd0d 100644 --- a/src/libstd/os.rs +++ b/src/libstd/os.rs @@ -40,14 +40,16 @@ use libc::{c_void, c_int}; use libc; use boxed::Box; use ops::Drop; -use option::{Some, None, Option}; +use option::Option; +use option::Option::{Some, None}; use os; use path::{Path, GenericPath, BytesContainer}; use sys; use sys::os as os_imp; use ptr::RawPtr; use ptr; -use result::{Err, Ok, Result}; +use result::Result; +use result::Result::{Err, Ok}; use slice::{AsSlice, SlicePrelude, PartialEqSlicePrelude}; use slice::CloneSliceAllocPrelude; use str::{Str, StrPrelude, StrAllocating}; @@ -160,7 +162,8 @@ pub fn getcwd() -> IoResult { pub mod windows { use libc::types::os::arch::extra::DWORD; use libc; - use option::{None, Option}; + use option::Option; + use option::Option::None; use option; use os::TMPBUF_SZ; use slice::{SlicePrelude}; @@ -196,7 +199,7 @@ pub mod windows { // set `res` to None and continue. let s = String::from_utf16(sub) .expect("fill_utf16_buf_and_decode: closure created invalid UTF-16"); - res = option::Some(s) + res = option::Option::Some(s) } } return res; @@ -1799,7 +1802,7 @@ mod tests { fn test_setenv() { let n = make_rand_name(); setenv(n.as_slice(), "VALUE"); - assert_eq!(getenv(n.as_slice()), option::Some("VALUE".to_string())); + assert_eq!(getenv(n.as_slice()), option::Option::Some("VALUE".to_string())); } #[test] @@ -1807,7 +1810,7 @@ mod tests { let n = make_rand_name(); setenv(n.as_slice(), "VALUE"); unsetenv(n.as_slice()); - assert_eq!(getenv(n.as_slice()), option::None); + assert_eq!(getenv(n.as_slice()), option::Option::None); } #[test] @@ -1816,9 +1819,9 @@ mod tests { let n = make_rand_name(); setenv(n.as_slice(), "1"); setenv(n.as_slice(), "2"); - assert_eq!(getenv(n.as_slice()), option::Some("2".to_string())); + assert_eq!(getenv(n.as_slice()), option::Option::Some("2".to_string())); setenv(n.as_slice(), ""); - assert_eq!(getenv(n.as_slice()), option::Some("".to_string())); + assert_eq!(getenv(n.as_slice()), option::Option::Some("".to_string())); } // Windows GetEnvironmentVariable requires some extra work to make sure @@ -1835,7 +1838,7 @@ mod tests { let n = make_rand_name(); setenv(n.as_slice(), s.as_slice()); debug!("{}", s.clone()); - assert_eq!(getenv(n.as_slice()), option::Some(s)); + assert_eq!(getenv(n.as_slice()), option::Option::Some(s)); } #[test] @@ -1872,7 +1875,7 @@ mod tests { // MingW seems to set some funky environment variables like // "=C:=C:\MinGW\msys\1.0\bin" and "!::=::\" that are returned // from env() but not visible from getenv(). - assert!(v2.is_none() || v2 == option::Some(v)); + assert!(v2.is_none() || v2 == option::Option::Some(v)); } } @@ -1959,7 +1962,7 @@ mod tests { #[test] fn memory_map_rw() { - use result::{Ok, Err}; + use result::Result::{Ok, Err}; let chunk = match os::MemoryMap::new(16, &[ os::MapReadable, @@ -1978,7 +1981,7 @@ mod tests { #[test] fn memory_map_file() { - use result::{Ok, Err}; + use result::Result::{Ok, Err}; use os::*; use libc::*; use io::fs; diff --git a/src/libstd/path/mod.rs b/src/libstd/path/mod.rs index b17106e811f62..01b42395471fc 100644 --- a/src/libstd/path/mod.rs +++ b/src/libstd/path/mod.rs @@ -66,7 +66,8 @@ use c_str::CString; use clone::Clone; use fmt; use iter::IteratorExt; -use option::{Option, None, Some}; +use option::Option; +use option::Option::{None, Some}; use str; use str::{CowString, MaybeOwned, Str, StrPrelude}; use string::String; diff --git a/src/libstd/path/posix.rs b/src/libstd/path/posix.rs index cc8fcccf14a06..0bc4c2e42ae3e 100644 --- a/src/libstd/path/posix.rs +++ b/src/libstd/path/posix.rs @@ -17,7 +17,8 @@ use hash; use io::Writer; use iter::{DoubleEndedIteratorExt, AdditiveIterator, Extend}; use iter::{Iterator, IteratorExt, Map}; -use option::{Option, None, Some}; +use option::Option; +use option::Option::{None, Some}; use kinds::Sized; use str::{FromStr, Str}; use str; diff --git a/src/libstd/path/windows.rs b/src/libstd/path/windows.rs index 6a6551af4999b..cee9d72513336 100644 --- a/src/libstd/path/windows.rs +++ b/src/libstd/path/windows.rs @@ -23,7 +23,8 @@ use io::Writer; use iter::{AdditiveIterator, DoubleEndedIteratorExt, Extend}; use iter::{Iterator, IteratorExt, Map}; use mem; -use option::{Option, Some, None}; +use option::Option; +use option::Option::{Some, None}; use slice::{AsSlice, SlicePrelude}; use str::{CharSplits, FromStr, Str, StrAllocating, StrVector, StrPrelude}; use string::String; diff --git a/src/libstd/rand/mod.rs b/src/libstd/rand/mod.rs index da690f5d154df..413d9267152eb 100644 --- a/src/libstd/rand/mod.rs +++ b/src/libstd/rand/mod.rs @@ -227,7 +227,7 @@ use io::IoResult; use iter::{Iterator, IteratorExt}; use mem; use rc::Rc; -use result::{Ok, Err}; +use result::Result::{Ok, Err}; use vec::Vec; #[cfg(not(target_word_size="64"))] diff --git a/src/libstd/rand/os.rs b/src/libstd/rand/os.rs index 2a4d8347c30c9..37628b65388e7 100644 --- a/src/libstd/rand/os.rs +++ b/src/libstd/rand/os.rs @@ -23,7 +23,7 @@ mod imp { use path::Path; use rand::Rng; use rand::reader::ReaderRng; - use result::{Ok, Err}; + use result::Result::{Ok, Err}; use slice::SlicePrelude; use mem; use os::errno; @@ -173,7 +173,7 @@ mod imp { use mem; use os; use rand::Rng; - use result::{Ok}; + use result::Result::{Ok}; use self::libc::{c_int, size_t}; use slice::{SlicePrelude}; @@ -240,7 +240,7 @@ mod imp { use ops::Drop; use os; use rand::Rng; - use result::{Ok, Err}; + use result::Result::{Ok, Err}; use self::libc::{DWORD, BYTE, LPCSTR, BOOL}; use self::libc::types::os::arch::extra::{LONG_PTR}; use slice::{SlicePrelude}; diff --git a/src/libstd/rand/reader.rs b/src/libstd/rand/reader.rs index 796bf7853f73b..ca6322247c2ab 100644 --- a/src/libstd/rand/reader.rs +++ b/src/libstd/rand/reader.rs @@ -12,7 +12,7 @@ use io::Reader; use rand::Rng; -use result::{Ok, Err}; +use result::Result::{Ok, Err}; use slice::SlicePrelude; /// An RNG that reads random bytes straight from a `Reader`. This will diff --git a/src/libstd/rt/backtrace.rs b/src/libstd/rt/backtrace.rs index 0103fe670e76f..f55cb5404304b 100644 --- a/src/libstd/rt/backtrace.rs +++ b/src/libstd/rt/backtrace.rs @@ -14,9 +14,9 @@ use io::{IoResult, Writer}; use iter::{Iterator, IteratorExt}; -use option::{Some, None}; +use option::Option::{Some, None}; use os; -use result::{Ok, Err}; +use result::Result::{Ok, Err}; use str::{StrPrelude, from_str}; use sync::atomic; use unicode::char::UnicodeChar; @@ -236,8 +236,9 @@ mod imp { use io::{IoResult, Writer}; use libc; use mem; - use option::{Some, None, Option}; - use result::{Ok, Err}; + use option::Option; + use option::Option::{Some, None}; + use result::Result::{Ok, Err}; use rustrt::mutex::{StaticNativeMutex, NATIVE_MUTEX_INIT}; /// As always - iOS on arm uses SjLj exceptions and @@ -664,9 +665,9 @@ mod imp { use libc; use mem; use ops::Drop; - use option::{Some, None}; + use option::Option::{Some, None}; use path::Path; - use result::{Ok, Err}; + use result::Result::{Ok, Err}; use rustrt::mutex::{StaticNativeMutex, NATIVE_MUTEX_INIT}; use slice::SlicePrelude; use str::StrPrelude; diff --git a/src/libstd/rt/util.rs b/src/libstd/rt/util.rs index 92657d1b59bee..ce359c7b0e006 100644 --- a/src/libstd/rt/util.rs +++ b/src/libstd/rt/util.rs @@ -9,7 +9,8 @@ // except according to those terms. use libc::uintptr_t; -use option::{Some, None, Option}; +use option::Option; +use option::Option::{Some, None}; use os; use str::{FromStr, from_str, Str}; use sync::atomic; diff --git a/src/libstd/sys/unix/fs.rs b/src/libstd/sys/unix/fs.rs index 4b47b768d600c..a773ef7e31747 100644 --- a/src/libstd/sys/unix/fs.rs +++ b/src/libstd/sys/unix/fs.rs @@ -20,7 +20,7 @@ use prelude::*; use io::{FilePermission, Write, UnstableFileStat, Open, FileAccess, FileMode}; use io::{IoResult, FileStat, SeekStyle, Reader}; use io::{Read, Truncate, SeekCur, SeekSet, ReadWrite, SeekEnd, Append}; -use result::{Ok, Err}; +use result::Result::{Ok, Err}; use sys::retry; use sys_common::{keep_going, eof, mkerr_libc}; diff --git a/src/libstd/task.rs b/src/libstd/task.rs index a0ee08570d90d..8b4dbf61c181d 100644 --- a/src/libstd/task.rs +++ b/src/libstd/task.rs @@ -49,7 +49,8 @@ use boxed::Box; use comm::channel; use io::{Writer, stdio}; use kinds::{Send, marker}; -use option::{None, Some, Option}; +use option::Option; +use option::Option::{None, Some}; use result::Result; use rustrt::local::Local; use rustrt::task::Task; @@ -172,9 +173,10 @@ impl TaskBuilder { /// # Return value /// /// If the child task executes successfully (without panicking) then the - /// future returns `result::Ok` containing the value returned by the - /// function. If the child task panics then the future returns `result::Err` - /// containing the argument to `panic!(...)` as an `Any` trait object. + /// future returns `result::Result::Ok` containing the value returned by the + /// function. If the child task panics then the future returns + /// `result::Result::Err` containing the argument to `panic!(...)` as an + /// `Any` trait object. #[experimental = "Futures are experimental."] pub fn try_future(self, f: proc():Send -> T) -> Future>> { @@ -268,7 +270,7 @@ mod test { use borrow::IntoCow; use boxed::BoxAny; use prelude::*; - use result::{Ok, Err}; + use result::Result::{Ok, Err}; use result; use std::io::{ChanReader, ChanWriter}; use string::String; @@ -330,7 +332,7 @@ mod test { match try(proc() { "Success!".to_string() }).as_ref().map(|s| s.as_slice()) { - result::Ok("Success!") => (), + result::Result::Ok("Success!") => (), _ => panic!() } } @@ -340,8 +342,8 @@ mod test { match try(proc() { panic!() }) { - result::Err(_) => (), - result::Ok(()) => panic!() + result::Result::Err(_) => (), + result::Result::Ok(()) => panic!() } } diff --git a/src/libstd/thread_local/mod.rs b/src/libstd/thread_local/mod.rs index e2e8461ea54d4..029b8bf113877 100644 --- a/src/libstd/thread_local/mod.rs +++ b/src/libstd/thread_local/mod.rs @@ -115,7 +115,7 @@ macro_rules! thread_local( use std::cell::UnsafeCell as __UnsafeCell; use std::thread_local::KeyInner as __KeyInner; use std::option::Option as __Option; - use std::option::None as __None; + use std::option::Option::None as __None; __thread_local_inner!(static __KEY: __UnsafeCell<__Option<$t>> = { __UnsafeCell { value: __None } @@ -132,7 +132,7 @@ macro_rules! thread_local( use std::cell::UnsafeCell as __UnsafeCell; use std::thread_local::KeyInner as __KeyInner; use std::option::Option as __Option; - use std::option::None as __None; + use std::option::Option::None as __None; __thread_local_inner!(static __KEY: __UnsafeCell<__Option<$t>> = { __UnsafeCell { value: __None } @@ -198,7 +198,7 @@ macro_rules! __thread_local_inner( inner: ::std::cell::UnsafeCell { value: $init }, os: ::std::thread_local::OsStaticKey { inner: ::std::thread_local::OS_INIT_INNER, - dtor: ::std::option::Some(__destroy), + dtor: ::std::option::Option::Some(__destroy), }, } }; diff --git a/src/libstd/time/duration.rs b/src/libstd/time/duration.rs index ec2d62ff85cb1..63eb9a9873624 100644 --- a/src/libstd/time/duration.rs +++ b/src/libstd/time/duration.rs @@ -14,9 +14,11 @@ use {fmt, i64}; use ops::{Add, Sub, Mul, Div, Neg}; -use option::{Option, Some, None}; +use option::Option; +use option::Option::{Some, None}; use num::Int; -use result::{Result, Ok, Err}; +use result::Result; +use result::Result::{Ok, Err}; /// The number of nanoseconds in a microsecond. const NANOS_PER_MICRO: i32 = 1000; @@ -387,7 +389,7 @@ fn div_rem_64(this: i64, other: i64) -> (i64, i64) { mod tests { use super::{Duration, MIN, MAX}; use {i32, i64}; - use option::{Some, None}; + use option::Option::{Some, None}; use string::ToString; #[test] diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs index bd01e5e643020..b4bb1a1a52963 100644 --- a/src/libsyntax/ext/build.rs +++ b/src/libsyntax/ext/build.rs @@ -680,6 +680,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { let some = vec!( self.ident_of("std"), self.ident_of("option"), + self.ident_of("Option"), self.ident_of("Some")); self.expr_call_global(sp, some, vec!(expr)) } @@ -688,6 +689,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { let none = self.path_global(sp, vec!( self.ident_of("std"), self.ident_of("option"), + self.ident_of("Option"), self.ident_of("None"))); self.expr_path(none) } @@ -732,6 +734,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { let ok = vec!( self.ident_of("std"), self.ident_of("result"), + self.ident_of("Result"), self.ident_of("Ok")); self.expr_call_global(sp, ok, vec!(expr)) } @@ -740,6 +743,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { let err = vec!( self.ident_of("std"), self.ident_of("result"), + self.ident_of("Result"), self.ident_of("Err")); self.expr_call_global(sp, err, vec!(expr)) } @@ -810,6 +814,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { let some = vec!( self.ident_of("std"), self.ident_of("option"), + self.ident_of("Option"), self.ident_of("Some")); let path = self.path_global(span, some); self.pat_enum(span, path, vec!(pat)) @@ -819,6 +824,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { let some = vec!( self.ident_of("std"), self.ident_of("option"), + self.ident_of("Option"), self.ident_of("None")); let path = self.path_global(span, some); self.pat_enum(span, path, vec!()) @@ -828,6 +834,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { let some = vec!( self.ident_of("std"), self.ident_of("result"), + self.ident_of("Result"), self.ident_of("Ok")); let path = self.path_global(span, some); self.pat_enum(span, path, vec!(pat)) @@ -837,6 +844,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { let some = vec!( self.ident_of("std"), self.ident_of("result"), + self.ident_of("Result"), self.ident_of("Err")); let path = self.path_global(span, some); self.pat_enum(span, path, vec!(pat)) diff --git a/src/libsyntax/ext/deriving/cmp/ord.rs b/src/libsyntax/ext/deriving/cmp/ord.rs index 98345e1dd6724..787c6e844d514 100644 --- a/src/libsyntax/ext/deriving/cmp/ord.rs +++ b/src/libsyntax/ext/deriving/cmp/ord.rs @@ -105,6 +105,7 @@ pub fn cs_partial_cmp(cx: &mut ExtCtxt, span: Span, let ordering = cx.path_global(span, vec!(cx.ident_of("std"), cx.ident_of("cmp"), + cx.ident_of("Ordering"), cx.ident_of("Equal"))); let ordering = cx.expr_path(ordering); let equals_expr = cx.expr_some(span, ordering); @@ -120,9 +121,9 @@ pub fn cs_partial_cmp(cx: &mut ExtCtxt, span: Span, Builds: let __test = ::std::cmp::PartialOrd::partial_cmp(&self_field1, &other_field1); - if __test == ::std::option::Some(::std::cmp::Equal) { + if __test == ::std::option::Option::Some(::std::cmp::Ordering::Equal) { let __test = ::std::cmp::PartialOrd::partial_cmp(&self_field2, &other_field2); - if __test == ::std::option::Some(::std::cmp::Equal) { + if __test == ::std::option::Option::Some(::std::cmp::Ordering::Equal) { ... } else { __test @@ -139,7 +140,7 @@ pub fn cs_partial_cmp(cx: &mut ExtCtxt, span: Span, false, |cx, span, old, self_f, other_fs| { // let __test = new; - // if __test == Some(::std::cmp::Equal) { + // if __test == Some(::std::cmp::Ordering::Equal) { // old // } else { // __test diff --git a/src/libsyntax/ext/deriving/cmp/totalord.rs b/src/libsyntax/ext/deriving/cmp/totalord.rs index d84ad677e5df5..83af45462ec6e 100644 --- a/src/libsyntax/ext/deriving/cmp/totalord.rs +++ b/src/libsyntax/ext/deriving/cmp/totalord.rs @@ -70,9 +70,9 @@ pub fn cs_cmp(cx: &mut ExtCtxt, span: Span, Builds: let __test = self_field1.cmp(&other_field2); - if other == ::std::cmp::Equal { + if other == ::std::cmp::Ordering::Equal { let __test = self_field2.cmp(&other_field2); - if __test == ::std::cmp::Equal { + if __test == ::std::cmp::Ordering::Equal { ... } else { __test @@ -89,7 +89,7 @@ pub fn cs_cmp(cx: &mut ExtCtxt, span: Span, false, |cx, span, old, new| { // let __test = new; - // if __test == ::std::cmp::Equal { + // if __test == ::std::cmp::Ordering::Equal { // old // } else { // __test diff --git a/src/libsyntax/ext/env.rs b/src/libsyntax/ext/env.rs index 87e257c52cd25..e6a44c57f1b65 100644 --- a/src/libsyntax/ext/env.rs +++ b/src/libsyntax/ext/env.rs @@ -36,6 +36,7 @@ pub fn expand_option_env<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenT true, vec!(cx.ident_of("std"), cx.ident_of("option"), + cx.ident_of("Option"), cx.ident_of("None")), Vec::new(), vec!(cx.ty_rptr(sp, @@ -50,6 +51,7 @@ pub fn expand_option_env<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenT cx.expr_call_global(sp, vec!(cx.ident_of("std"), cx.ident_of("option"), + cx.ident_of("Option"), cx.ident_of("Some")), vec!(cx.expr_str(sp, token::intern_and_get_ident( diff --git a/src/libterm/terminfo/parm.rs b/src/libterm/terminfo/parm.rs index 62a49c5d90270..d111864a5f1bc 100644 --- a/src/libterm/terminfo/parm.rs +++ b/src/libterm/terminfo/parm.rs @@ -576,7 +576,7 @@ fn format(val: Param, op: FormatOp, flags: Flags) -> Result ,String> { #[cfg(test)] mod test { use super::{expand,Param,Words,Variables,Number}; - use std::result::Ok; + use std::result::Result::Ok; #[test] fn test_basic_setabf() { diff --git a/src/libtime/lib.rs b/src/libtime/lib.rs index 1d5268b975481..0ad20d4e6404d 100644 --- a/src/libtime/lib.rs +++ b/src/libtime/lib.rs @@ -1263,7 +1263,7 @@ mod tests { InvalidFormatSpecifier}; use std::f64; - use std::result::{Err, Ok}; + use std::result::Result::{Err, Ok}; use std::time::Duration; use self::test::Bencher; diff --git a/src/libunicode/normalize.rs b/src/libunicode/normalize.rs index cd46fc6a56dd0..29a8b1204b856 100644 --- a/src/libunicode/normalize.rs +++ b/src/libunicode/normalize.rs @@ -10,8 +10,9 @@ //! Functions for computing canonical and compatible decompositions for Unicode characters. -use core::cmp::{Equal, Less, Greater}; -use core::option::{Option, Some, None}; +use core::cmp::Ordering::{Equal, Less, Greater}; +use core::option::Option; +use core::option::Option::{Some, None}; use core::slice; use core::slice::SlicePrelude; use tables::normalization::{canonical_table, compatibility_table, composition_table}; diff --git a/src/libunicode/tables.rs b/src/libunicode/tables.rs index 7cece6701dc85..c91ce5c6464e8 100644 --- a/src/libunicode/tables.rs +++ b/src/libunicode/tables.rs @@ -17,7 +17,7 @@ pub const UNICODE_VERSION: (uint, uint, uint) = (7, 0, 0); fn bsearch_range_table(c: char, r: &'static [(char,char)]) -> bool { - use core::cmp::{Equal, Less, Greater}; + use core::cmp::Ordering::{Equal, Less, Greater}; use core::slice::SlicePrelude; r.binary_search(|&(lo,hi)| { if lo <= c && c <= hi { Equal } @@ -6241,7 +6241,7 @@ pub mod normalization { fn bsearch_range_value_table(c: char, r: &'static [(char, char, u8)]) -> u8 { - use core::cmp::{Equal, Less, Greater}; + use core::cmp::Ordering::{Equal, Less, Greater}; use core::slice::SlicePrelude; use core::slice; match r.binary_search(|&(lo, hi, _)| { @@ -6366,10 +6366,11 @@ pub mod normalization { } pub mod conversions { - use core::cmp::{Equal, Less, Greater}; + use core::cmp::Ordering::{Equal, Less, Greater}; use core::slice::SlicePrelude; use core::tuple::Tuple2; - use core::option::{Option, Some, None}; + use core::option::Option; + use core::option::Option::{Some, None}; use core::slice; pub fn to_lower(c: char) -> char { @@ -6934,12 +6935,13 @@ pub mod conversions { } pub mod charwidth { - use core::option::{Option, Some, None}; + use core::option::Option; + use core::option::Option::{Some, None}; use core::slice::SlicePrelude; use core::slice; fn bsearch_range_value_table(c: char, is_cjk: bool, r: &'static [(char, char, u8, u8)]) -> u8 { - use core::cmp::{Equal, Less, Greater}; + use core::cmp::Ordering::{Equal, Less, Greater}; match r.binary_search(|&(lo, hi, _, _)| { if lo <= c && c <= hi { Equal } else if hi < c { Less } @@ -7154,7 +7156,7 @@ pub mod grapheme { } fn bsearch_range_value_table(c: char, r: &'static [(char, char, GraphemeCat)]) -> GraphemeCat { - use core::cmp::{Equal, Less, Greater}; + use core::cmp::Ordering::{Equal, Less, Greater}; match r.binary_search(|&(lo, hi, _)| { if lo <= c && c <= hi { Equal } else if hi < c { Less } diff --git a/src/libunicode/u_str.rs b/src/libunicode/u_str.rs index a5f7614257595..e4b2b682b2cff 100644 --- a/src/libunicode/u_str.rs +++ b/src/libunicode/u_str.rs @@ -21,7 +21,8 @@ use core::slice::SlicePrelude; use core::iter::{Filter, AdditiveIterator, Iterator, IteratorExt}; use core::iter::{DoubleEndedIterator, DoubleEndedIteratorExt}; use core::kinds::Sized; -use core::option::{Option, None, Some}; +use core::option::Option; +use core::option::Option::{None, Some}; use core::str::{CharSplits, StrPrelude}; use u_char::UnicodeChar; use tables::grapheme::GraphemeCat; diff --git a/src/test/bench/shootout-k-nucleotide-pipes.rs b/src/test/bench/shootout-k-nucleotide-pipes.rs index 4005c11e6b614..45d2cbea8fad9 100644 --- a/src/test/bench/shootout-k-nucleotide-pipes.rs +++ b/src/test/bench/shootout-k-nucleotide-pipes.rs @@ -77,8 +77,8 @@ fn sort_and_fmt(mm: &HashMap , uint>, total: uint) -> String { fn find(mm: &HashMap , uint>, key: String) -> uint { let key = key.into_ascii().as_slice().to_lowercase().into_string(); match mm.get(key.as_bytes()) { - option::None => { return 0u; } - option::Some(&num) => { return num; } + option::Option::None => { return 0u; } + option::Option::Some(&num) => { return num; } } } @@ -190,8 +190,8 @@ fn main() { // start processing if this is the one ('>', false) => { match line.as_slice().slice_from(1).find_str("THREE") { - option::Some(_) => { proc_mode = true; } - option::None => { } + option::Option::Some(_) => { proc_mode = true; } + option::Option::None => { } } } diff --git a/src/test/bench/shootout-pfib.rs b/src/test/bench/shootout-pfib.rs index 9cc86e91fbed7..15a5cb0c9bfff 100644 --- a/src/test/bench/shootout-pfib.rs +++ b/src/test/bench/shootout-pfib.rs @@ -21,7 +21,7 @@ extern crate getopts; use std::os; -use std::result::{Ok, Err}; +use std::result::Result::{Ok, Err}; use std::task; use std::time::Duration; diff --git a/src/test/compile-fail/lint-unused-imports.rs b/src/test/compile-fail/lint-unused-imports.rs index d9bf722f73e42..b1a6c82a734fe 100644 --- a/src/test/compile-fail/lint-unused-imports.rs +++ b/src/test/compile-fail/lint-unused-imports.rs @@ -18,8 +18,8 @@ use std::mem::*; // shouldn't get errors for not using // everything imported // Should get errors for both 'Some' and 'None' -use std::option::{Some, None}; //~ ERROR unused import - //~^ ERROR unused import +use std::option::Option::{Some, None}; //~ ERROR unused import + //~^ ERROR unused import use test::A; //~ ERROR unused import // Be sure that if we just bring some methods into scope that they're also diff --git a/src/test/run-fail/result-get-panic.rs b/src/test/run-fail/result-get-panic.rs index 6098b97c79a94..df14efd6c3a97 100644 --- a/src/test/run-fail/result-get-panic.rs +++ b/src/test/run-fail/result-get-panic.rs @@ -10,8 +10,8 @@ // error-pattern:called `Result::unwrap()` on an `Err` value -use std::result; +use std::result::Result::Err; fn main() { - println!("{}", result::Err::("kitty".to_string()).unwrap()); + println!("{}", Err::("kitty".to_string()).unwrap()); } diff --git a/src/test/run-pass/deriving-cmp-shortcircuit.rs b/src/test/run-pass/deriving-cmp-shortcircuit.rs index fd59b804da376..b68d8058381d2 100644 --- a/src/test/run-pass/deriving-cmp-shortcircuit.rs +++ b/src/test/run-pass/deriving-cmp-shortcircuit.rs @@ -39,5 +39,5 @@ pub fn main() { assert!(a != b); assert!(a < b); - assert_eq!(a.cmp(&b), ::std::cmp::Less); + assert_eq!(a.cmp(&b), ::std::cmp::Ordering::Less); } diff --git a/src/test/run-pass/deriving-self-lifetime-totalord-totaleq.rs b/src/test/run-pass/deriving-self-lifetime-totalord-totaleq.rs index 1187a9a8bc4a7..d63c264479a93 100644 --- a/src/test/run-pass/deriving-self-lifetime-totalord-totaleq.rs +++ b/src/test/run-pass/deriving-self-lifetime-totalord-totaleq.rs @@ -10,7 +10,7 @@ // ignore-test FIXME #11820: & is unreliable in deriving -use std::cmp::{Less,Equal,Greater}; +use std::cmp::Ordering::{Less,Equal,Greater}; #[deriving(Eq,Ord)] struct A<'a> { diff --git a/src/test/run-pass/enum-nullable-const-null-with-fields.rs b/src/test/run-pass/enum-nullable-const-null-with-fields.rs index a48f3bcd59ca4..4b839d740fc7a 100644 --- a/src/test/run-pass/enum-nullable-const-null-with-fields.rs +++ b/src/test/run-pass/enum-nullable-const-null-with-fields.rs @@ -8,7 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::result::{Result,Ok}; +use std::result::Result; +use std::result::Result::Ok; static C: Result<(), Box> = Ok(()); diff --git a/src/test/run-pass/issue-2804.rs b/src/test/run-pass/issue-2804.rs index ec19b95ab1a48..6f1f2cea8ec3c 100644 --- a/src/test/run-pass/issue-2804.rs +++ b/src/test/run-pass/issue-2804.rs @@ -24,14 +24,14 @@ enum object { fn lookup(table: json::Object, key: String, default: String) -> String { match table.find(&key.to_string()) { - option::Some(&Json::String(ref s)) => { + option::Option::Some(&Json::String(ref s)) => { s.to_string() } - option::Some(value) => { + option::Option::Some(value) => { println!("{} was expected to be a string but is a {}", key, value); default } - option::None => { + option::Option::None => { default } } diff --git a/src/test/run-pass/issue-3424.rs b/src/test/run-pass/issue-3424.rs index 2dac64b2ec81f..81efacb9bcbad 100644 --- a/src/test/run-pass/issue-3424.rs +++ b/src/test/run-pass/issue-3424.rs @@ -20,7 +20,7 @@ type rsrc_loader = proc(path: &Path):'static -> result::Result; fn tester() { let loader: rsrc_loader = proc(_path) { - result::Ok("more blah".to_string()) + result::Result::Ok("more blah".to_string()) }; let path = path::Path::new("blah"); diff --git a/src/test/run-pass/nullable-pointer-iotareduction.rs b/src/test/run-pass/nullable-pointer-iotareduction.rs index 520d067bca326..da1ad094df6a0 100644 --- a/src/test/run-pass/nullable-pointer-iotareduction.rs +++ b/src/test/run-pass/nullable-pointer-iotareduction.rs @@ -41,9 +41,9 @@ macro_rules! check_option { check_option!($e: $T, |ptr| assert!(*ptr == $e)); }}; ($e:expr: $T:ty, |$v:ident| $chk:expr) => {{ - assert!(option::None::<$T>.is_none()); + assert!(option::Option::None::<$T>.is_none()); let e = $e; - let s_ = option::Some::<$T>(e); + let s_ = option::Option::Some::<$T>(e); let $v = s_.as_ref().unwrap(); $chk }} diff --git a/src/test/run-pass/send_str_hashmap.rs b/src/test/run-pass/send_str_hashmap.rs index ef485723c7e2b..1b0f2ec0a327f 100644 --- a/src/test/run-pass/send_str_hashmap.rs +++ b/src/test/run-pass/send_str_hashmap.rs @@ -11,7 +11,7 @@ extern crate collections; use std::collections::HashMap; -use std::option::Some; +use std::option::Option::Some; use std::str::SendStr; pub fn main() { diff --git a/src/test/run-pass/send_str_treemap.rs b/src/test/run-pass/send_str_treemap.rs index f72ca109b6e68..9334b673b515e 100644 --- a/src/test/run-pass/send_str_treemap.rs +++ b/src/test/run-pass/send_str_treemap.rs @@ -11,7 +11,7 @@ extern crate collections; use self::collections::TreeMap; -use std::option::Some; +use std::option::Option::Some; use std::str::SendStr; use std::string::ToString;