1
Fork 0

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
This commit is contained in:
Corey Farwell 2014-11-28 11:57:41 -05:00
parent 6f4c11be3b
commit 4ef16741e3
85 changed files with 277 additions and 195 deletions

View file

@ -994,7 +994,7 @@ An example of `use` declarations:
``` ```
use std::iter::range_step; use std::iter::range_step;
use std::option::{Some, None}; use std::option::Option::{Some, None};
use std::collections::hash_map::{mod, HashMap}; use std::collections::hash_map::{mod, HashMap};
fn foo<T>(_: T){} fn foo<T>(_: T){}
@ -1004,8 +1004,8 @@ fn main() {
// Equivalent to 'std::iter::range_step(0u, 10u, 2u);' // Equivalent to 'std::iter::range_step(0u, 10u, 2u);'
range_step(0u, 10u, 2u); range_step(0u, 10u, 2u);
// Equivalent to 'foo(vec![std::option::Some(1.0f64), // Equivalent to 'foo(vec![std::option::Option::Some(1.0f64),
// std::option::None]);' // std::option::Option::None]);'
foo(vec![Some(1.0f64), None]); foo(vec![Some(1.0f64), None]);
// Both `hash_map` and `HashMap` are in scope. // Both `hash_map` and `HashMap` are in scope.

View file

@ -292,7 +292,7 @@ def escape_char(c):
def emit_bsearch_range_table(f): def emit_bsearch_range_table(f):
f.write(""" f.write("""
fn bsearch_range_table(c: char, r: &'static [(char,char)]) -> bool { 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; use core::slice::SlicePrelude;
r.binary_search(|&(lo,hi)| { r.binary_search(|&(lo,hi)| {
if lo <= c && c <= hi { Equal } 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): def emit_conversions_module(f, lowerupper, upperlower):
f.write("pub mod conversions {") f.write("pub mod conversions {")
f.write(""" f.write("""
use core::cmp::{Equal, Less, Greater}; use core::cmp::Ordering::{Equal, Less, Greater};
use core::slice::SlicePrelude; use core::slice::SlicePrelude;
use core::tuple::Tuple2; use core::tuple::Tuple2;
use core::option::{Option, Some, None}; use core::option::Option;
use core::option::Option::{Some, None};
use core::slice; use core::slice;
pub fn to_lower(c: char) -> char { pub fn to_lower(c: char) -> char {
@ -403,7 +404,7 @@ def emit_grapheme_module(f, grapheme_table, grapheme_cats):
f.write(""" } f.write(""" }
fn bsearch_range_value_table(c: char, r: &'static [(char, char, GraphemeCat)]) -> GraphemeCat { 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, _)| { match r.binary_search(|&(lo, hi, _)| {
if lo <= c && c <= hi { Equal } if lo <= c && c <= hi { Equal }
else if hi < c { Less } 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): def emit_charwidth_module(f, width_table):
f.write("pub mod charwidth {\n") 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::SlicePrelude;\n")
f.write(" use core::slice;\n") f.write(" use core::slice;\n")
f.write(""" f.write("""
fn bsearch_range_value_table(c: char, is_cjk: bool, r: &'static [(char, char, u8, u8)]) -> u8 { 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, _, _)| { match r.binary_search(|&(lo, hi, _, _)| {
if lo <= c && c <= hi { Equal } if lo <= c && c <= hi { Equal }
else if hi < c { Less } else if hi < c { Less }
@ -530,7 +532,7 @@ def emit_norm_module(f, canon, compat, combine, norm_props):
f.write(""" f.write("""
fn bsearch_range_value_table(c: char, r: &'static [(char, char, u8)]) -> u8 { 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::SlicePrelude;
use core::slice; use core::slice;
match r.binary_search(|&(lo, hi, _)| { match r.binary_search(|&(lo, hi, _)| {

View file

@ -22,7 +22,8 @@ use core::kinds::{Sync, Send};
use core::mem::{min_align_of, size_of, drop}; use core::mem::{min_align_of, size_of, drop};
use core::mem; use core::mem;
use core::ops::{Drop, Deref}; 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::RawPtr;
use core::ptr; use core::ptr;
use heap::deallocate; use heap::deallocate;
@ -326,7 +327,8 @@ mod tests {
use std::comm::channel; use std::comm::channel;
use std::mem::drop; use std::mem::drop;
use std::ops::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::str::Str;
use std::sync::atomic; use std::sync::atomic;
use std::task; use std::task;

View file

@ -19,7 +19,8 @@ use core::kinds::Sized;
use core::mem; use core::mem;
use core::option::Option; use core::option::Option;
use core::raw::TraitObject; 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 /// A value that represents the global exchange heap. This is the default
/// place that the `box` keyword allocates into when no place is supplied. /// place that the `box` keyword allocates into when no place is supplied.

View file

@ -177,7 +177,8 @@ mod imp {
#[cfg(all(not(external_funcs), not(external_crate), jemalloc))] #[cfg(all(not(external_funcs), not(external_crate), jemalloc))]
mod imp { mod imp {
use core::option::{None, Option}; use core::option::Option;
use core::option::Option::None;
use core::ptr::{null_mut, null}; use core::ptr::{null_mut, null};
use core::num::Int; use core::num::Int;
use libc::{c_char, c_int, c_void, size_t}; use libc::{c_char, c_int, c_void, size_t};

View file

@ -149,10 +149,12 @@ use core::fmt;
use core::kinds::marker; use core::kinds::marker;
use core::mem::{transmute, min_align_of, size_of, forget}; use core::mem::{transmute, min_align_of, size_of, forget};
use core::ops::{Deref, Drop}; 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;
use core::ptr::RawPtr; use core::ptr::RawPtr;
use core::result::{Result, Ok, Err}; use core::result::Result;
use core::result::Result::{Ok, Err};
use heap::deallocate; use heap::deallocate;
@ -739,8 +741,9 @@ impl<T> RcBoxPtr<T> for Weak<T> {
mod tests { mod tests {
use super::{Rc, Weak, weak_count, strong_count}; use super::{Rc, Weak, weak_count, strong_count};
use std::cell::RefCell; use std::cell::RefCell;
use std::option::{Option, Some, None}; use std::option::Option;
use std::result::{Err, Ok}; use std::option::Option::{Some, None};
use std::result::Result::{Err, Ok};
use std::mem::drop; use std::mem::drop;
use std::clone::Clone; use std::clone::Clone;

View file

@ -833,8 +833,10 @@ mod tests {
use std::default::Default; use std::default::Default;
use std::char::Char; use std::char::Char;
use std::clone::Clone; use std::clone::Clone;
use std::cmp::{Equal, Greater, Less, Ord, PartialOrd, Equiv}; use std::cmp::{Ord, PartialOrd, Equiv};
use std::option::{Some, None}; use std::cmp::Ordering::{Equal, Greater, Less};
use std::option::Option;
use std::option::Option::{Some, None};
use std::ptr::RawPtr; use std::ptr::RawPtr;
use std::iter::{Iterator, IteratorExt, DoubleEndedIteratorExt}; use std::iter::{Iterator, IteratorExt, DoubleEndedIteratorExt};

View file

@ -72,7 +72,8 @@
#![stable] #![stable]
use mem::{transmute}; use mem::{transmute};
use option::{Option, Some, None}; use option::Option;
use option::Option::{Some, None};
use raw::TraitObject; use raw::TraitObject;
use intrinsics::TypeId; use intrinsics::TypeId;

View file

@ -160,7 +160,8 @@ use cmp::PartialEq;
use default::Default; use default::Default;
use kinds::{marker, Copy}; use kinds::{marker, Copy};
use ops::{Deref, DerefMut, Drop}; 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. /// A mutable memory location that admits only `Copy` data.
#[unstable = "likely to be renamed; otherwise stable"] #[unstable = "likely to be renamed; otherwise stable"]

View file

@ -16,7 +16,8 @@
#![doc(primitive = "char")] #![doc(primitive = "char")]
use mem::transmute; use mem::transmute;
use option::{None, Option, Some}; use option::Option;
use option::Option::{None, Some};
use iter::{range_step, Iterator, RangeStep}; use iter::{range_step, Iterator, RangeStep};
use slice::SlicePrelude; use slice::SlicePrelude;

View file

@ -44,7 +44,8 @@
pub use self::Ordering::*; pub use self::Ordering::*;
use kinds::Sized; 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. /// 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 // Implementation of PartialEq, Eq, PartialOrd and Ord for primitive types
mod impls { mod impls {
use cmp::{PartialOrd, Ord, PartialEq, Eq, Ordering, use cmp::{PartialOrd, Ord, PartialEq, Eq, Ordering};
Less, Greater, Equal}; use cmp::Ordering::{Less, Greater, Equal};
use kinds::Sized; use kinds::Sized;
use option::{Option, Some, None}; use option::Option;
use option::Option::{Some, None};
macro_rules! partial_eq_impl( macro_rules! partial_eq_impl(
($($t:ty)*) => ($( ($($t:ty)*) => ($(

View file

@ -20,7 +20,7 @@ use fmt;
use iter::{range, DoubleEndedIteratorExt}; use iter::{range, DoubleEndedIteratorExt};
use num::{Float, FPNaN, FPInfinite, ToPrimitive}; use num::{Float, FPNaN, FPInfinite, ToPrimitive};
use num::cast; use num::cast;
use result::Ok; use result::Result::Ok;
use slice::{mod, SlicePrelude}; use slice::{mod, SlicePrelude};
use str::StrPrelude; use str::StrPrelude;

View file

@ -17,9 +17,10 @@ use cell::{Cell, Ref, RefMut};
use iter::{Iterator, IteratorExt, range}; use iter::{Iterator, IteratorExt, range};
use kinds::{Copy, Sized}; use kinds::{Copy, Sized};
use mem; use mem;
use option::{Option, Some, None}; use option::Option;
use option::Option::{Some, None};
use ops::Deref; use ops::Deref;
use result::{Ok, Err}; use result::Result::{Ok, Err};
use result; use result;
use slice::SlicePrelude; use slice::SlicePrelude;
use slice; use slice;

View file

@ -62,7 +62,8 @@ use cmp::Ord;
use mem; use mem;
use num::{ToPrimitive, Int}; use num::{ToPrimitive, Int};
use ops::{Add, Deref}; use ops::{Add, Deref};
use option::{Option, Some, None}; use option::Option;
use option::Option::{Some, None};
use uint; use uint;
#[deprecated = "renamed to Extend"] pub use self::Extend as Extendable; #[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 { pub mod order {
use cmp; use cmp;
use cmp::{Eq, Ord, PartialOrd, PartialEq}; 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; use super::Iterator;
/// Compare `a` and `b` for equality using `Eq` /// 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 { pub fn cmp<A: Ord, T: Iterator<A>, S: Iterator<A>>(mut a: T, mut b: S) -> cmp::Ordering {
loop { loop {
match (a.next(), b.next()) { match (a.next(), b.next()) {
(None, None) => return cmp::Equal, (None, None) => return Equal,
(None, _ ) => return cmp::Less, (None, _ ) => return Less,
(_ , None) => return cmp::Greater, (_ , None) => return Greater,
(Some(x), Some(y)) => match x.cmp(&y) { (Some(x), Some(y)) => match x.cmp(&y) {
cmp::Equal => (), Equal => (),
non_eq => return non_eq, non_eq => return non_eq,
}, },
} }
@ -2492,11 +2495,11 @@ pub mod order {
-> Option<cmp::Ordering> { -> Option<cmp::Ordering> {
loop { loop {
match (a.next(), b.next()) { match (a.next(), b.next()) {
(None, None) => return Some(cmp::Equal), (None, None) => return Some(Equal),
(None, _ ) => return Some(cmp::Less), (None, _ ) => return Some(Less),
(_ , None) => return Some(cmp::Greater), (_ , None) => return Some(Greater),
(Some(x), Some(y)) => match x.partial_cmp(&y) { (Some(x), Some(y)) => match x.partial_cmp(&y) {
Some(cmp::Equal) => (), Some(Equal) => (),
non_eq => return non_eq, non_eq => return non_eq,
}, },
} }

View file

@ -30,7 +30,8 @@ use kinds::Copy;
use mem::size_of; use mem::size_of;
use ops::{Add, Sub, Mul, Div, Rem, Neg}; use ops::{Add, Sub, Mul, Div, Rem, Neg};
use ops::{Not, BitAnd, BitOr, BitXor, Shl, Shr}; 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}; use str::{FromStr, from_str, StrPrelude};
/// Simultaneous division and remainder /// Simultaneous division and remainder

View file

@ -149,7 +149,8 @@ use cmp::{Eq, Ord};
use default::Default; use default::Default;
use iter::{Iterator, IteratorExt, DoubleEndedIterator, FromIterator, ExactSizeIterator}; use iter::{Iterator, IteratorExt, DoubleEndedIterator, FromIterator, ExactSizeIterator};
use mem; use mem;
use result::{Result, Ok, Err}; use result::Result;
use result::Result::{Ok, Err};
use slice; use slice;
use slice::AsSlice; use slice::AsSlice;
use clone::Clone; use clone::Clone;

View file

@ -90,9 +90,12 @@
use mem; use mem;
use clone::Clone; use clone::Clone;
use intrinsics; 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_memory;
pub use intrinsics::copy_nonoverlapping_memory; pub use intrinsics::copy_nonoverlapping_memory;

View file

@ -236,7 +236,8 @@ use std::fmt::Show;
use slice; use slice;
use slice::AsSlice; use slice::AsSlice;
use iter::{Iterator, IteratorExt, DoubleEndedIterator, FromIterator, ExactSizeIterator}; 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`). /// `Result` is a type that represents either success (`Ok`) or failure (`Err`).
/// ///

View file

@ -36,13 +36,15 @@
use mem::transmute; use mem::transmute;
use clone::Clone; 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 cmp;
use default::Default; use default::Default;
use iter::*; use iter::*;
use num::Int; use num::Int;
use ops; use ops;
use option::{None, Option, Some}; use option::Option;
use option::Option::{None, Some};
use ptr; use ptr;
use ptr::RawPtr; use ptr::RawPtr;
use mem; use mem;
@ -1702,7 +1704,8 @@ pub mod raw {
use mem::transmute; use mem::transmute;
use ptr::RawPtr; use ptr::RawPtr;
use raw::Slice; 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, /// Form a slice from a pointer and length (as a number of units,
/// not bytes). /// not bytes).

View file

@ -29,7 +29,8 @@ use iter::range;
use kinds::Sized; use kinds::Sized;
use mem; use mem;
use num::Int; use num::Int;
use option::{Option, None, Some}; use option::Option;
use option::Option::{None, Some};
use ptr::RawPtr; use ptr::RawPtr;
use raw::{Repr, Slice}; use raw::{Repr, Slice};
use slice::{mod, SlicePrelude}; use slice::{mod, SlicePrelude};
@ -1209,9 +1210,11 @@ Section: Trait implementations
#[allow(missing_docs)] #[allow(missing_docs)]
pub mod traits { 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 iter::IteratorExt;
use option::{Option, Some}; use option::Option;
use option::Option::Some;
use ops; use ops;
use str::{Str, StrPrelude, eq_slice}; use str::{Str, StrPrelude, eq_slice};

View file

@ -69,7 +69,8 @@ pub use unit;
use clone::Clone; use clone::Clone;
use cmp::*; use cmp::*;
use default::Default; use default::Default;
use option::{Option, Some}; use option::Option;
use option::Option::Some;
// macro for implementing n-ary tuple functions and operations // macro for implementing n-ary tuple functions and operations
macro_rules! tuple_impls { macro_rules! tuple_impls {

View file

@ -48,7 +48,8 @@ pub fn test_num<T>(ten: T, two: T) where
#[cfg(test)] #[cfg(test)]
mod 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::Float;
use core::num::from_str_radix; use core::num::from_str_radix;

View file

@ -99,7 +99,7 @@ use self::Fail::*;
use self::Optval::*; use self::Optval::*;
use std::fmt; use std::fmt;
use std::result::{Err, Ok}; use std::result::Result::{Err, Ok};
use std::result; use std::result;
use std::string::String; use std::string::String;
@ -951,7 +951,7 @@ mod tests {
use super::*; use super::*;
use super::Fail::*; use super::Fail::*;
use std::result::{Err, Ok}; use std::result::Result::{Err, Ok};
use std::result; use std::result;
// Tests for reqopt // Tests for reqopt
@ -1392,8 +1392,8 @@ mod tests {
let args_single = vec!("-e".to_string(), "foo".to_string()); let args_single = vec!("-e".to_string(), "foo".to_string());
let matches_single = &match getopts(args_single.as_slice(), let matches_single = &match getopts(args_single.as_slice(),
opts.as_slice()) { opts.as_slice()) {
result::Ok(m) => m, result::Result::Ok(m) => m,
result::Err(_) => panic!() result::Result::Err(_) => panic!()
}; };
assert!(matches_single.opts_present(&["e".to_string()])); assert!(matches_single.opts_present(&["e".to_string()]));
assert!(matches_single.opts_present(&["encrypt".to_string(), "e".to_string()])); assert!(matches_single.opts_present(&["encrypt".to_string(), "e".to_string()]));
@ -1412,8 +1412,8 @@ mod tests {
"foo".to_string()); "foo".to_string());
let matches_both = &match getopts(args_both.as_slice(), let matches_both = &match getopts(args_both.as_slice(),
opts.as_slice()) { opts.as_slice()) {
result::Ok(m) => m, result::Result::Ok(m) => m,
result::Err(_) => panic!() result::Result::Err(_) => panic!()
}; };
assert!(matches_both.opts_present(&["e".to_string()])); assert!(matches_both.opts_present(&["e".to_string()]));
assert!(matches_both.opts_present(&["encrypt".to_string()])); assert!(matches_both.opts_present(&["encrypt".to_string()]));
@ -1437,8 +1437,8 @@ mod tests {
let opts = vec!(optmulti("L", "", "library directory", "LIB"), let opts = vec!(optmulti("L", "", "library directory", "LIB"),
optmulti("M", "", "something", "MMMM")); optmulti("M", "", "something", "MMMM"));
let matches = &match getopts(args.as_slice(), opts.as_slice()) { let matches = &match getopts(args.as_slice(), opts.as_slice()) {
result::Ok(m) => m, result::Result::Ok(m) => m,
result::Err(_) => panic!() result::Result::Err(_) => panic!()
}; };
assert!(matches.opts_present(&["L".to_string()])); assert!(matches.opts_present(&["L".to_string()]));
assert_eq!(matches.opts_str(&["L".to_string()]).unwrap(), "foo".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"), let opts = vec!(optmulti("L", "", "library directory", "LIB"),
optflagmulti("v", "verbose", "Verbose")); optflagmulti("v", "verbose", "Verbose"));
let matches = &match getopts(args.as_slice(), opts.as_slice()) { let matches = &match getopts(args.as_slice(), opts.as_slice()) {
result::Ok(m) => m, result::Result::Ok(m) => m,
result::Err(e) => panic!( "{}", e ) result::Result::Err(e) => panic!( "{}", e )
}; };
assert!(matches.opts_present(&["L".to_string()])); assert!(matches.opts_present(&["L".to_string()]));
assert_eq!(matches.opts_str(&["L".to_string()]).unwrap(), "verbose".to_string()); assert_eq!(matches.opts_str(&["L".to_string()]).unwrap(), "verbose".to_string());

View file

@ -120,7 +120,8 @@ pub mod reader {
use std::io::extensions::u64_from_be_bytes; use std::io::extensions::u64_from_be_bytes;
use std::mem::transmute; use std::mem::transmute;
use std::num::Int; use std::num::Int;
use std::option::{None, Option, Some}; use std::option::Option;
use std::option::Option::{None, Some};
use serialize; use serialize;
@ -1060,7 +1061,8 @@ mod tests {
use serialize::{Encodable, Decodable}; use serialize::{Encodable, Decodable};
use std::option::{None, Option, Some}; use std::option::Option;
use std::option::Option::{None, Some};
#[test] #[test]
fn test_vuint_at() { fn test_vuint_at() {

View file

@ -65,8 +65,8 @@ impl ArgType {
ArgType { ArgType {
kind: Indirect, kind: Indirect,
ty: ty, ty: ty,
cast: option::None, cast: option::Option::None,
pad: option::None, pad: option::Option::None,
attr: attr attr: attr
} }
} }

View file

@ -15,8 +15,7 @@ use middle::infer;
use middle::infer::resolve_type; use middle::infer::resolve_type;
use middle::infer::resolve::try_resolve_tvar_shallow; use middle::infer::resolve::try_resolve_tvar_shallow;
use std::result::{Err, Ok}; use std::result::Result::{Err, Ok};
use std::result;
use syntax::ast; use syntax::ast;
use syntax::codemap::Span; use syntax::codemap::Span;
use util::ppaux::Repr; use util::ppaux::Repr;
@ -38,8 +37,8 @@ pub fn suptype_with_fn<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
// n.b.: order of actual, expected is reversed // n.b.: order of actual, expected is reversed
match infer::mk_subty(fcx.infcx(), b_is_expected, infer::Misc(sp), match infer::mk_subty(fcx.infcx(), b_is_expected, infer::Misc(sp),
ty_b, ty_a) { ty_b, ty_a) {
result::Ok(()) => { /* ok */ } Ok(()) => { /* ok */ }
result::Err(ref err) => { Err(ref err) => {
handle_err(sp, ty_a, ty_b, err); handle_err(sp, ty_a, ty_b, err);
} }
} }
@ -69,8 +68,8 @@ pub fn coerce<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>, sp: Span,
try_resolve_tvar_shallow).unwrap_or(expected) try_resolve_tvar_shallow).unwrap_or(expected)
} else { expected }; } else { expected };
match fcx.mk_assignty(expr, expr_ty, expected) { match fcx.mk_assignty(expr, expr_ty, expected) {
result::Ok(()) => { /* ok */ } Ok(()) => { /* ok */ }
result::Err(ref err) => { Err(ref err) => {
fcx.report_mismatched_types(sp, expected, expr_ty, err); fcx.report_mismatched_types(sp, expected, expr_ty, err);
} }
} }

View file

@ -19,7 +19,8 @@ use core::kinds::Sized;
use fmt; use fmt;
use iter::IteratorExt; use iter::IteratorExt;
use mem; use mem;
use option::{Option, Some, None}; use option::Option;
use option::Option::{Some, None};
use slice::{SlicePrelude, AsSlice}; use slice::{SlicePrelude, AsSlice};
use str::{Str, StrPrelude}; use str::{Str, StrPrelude};
use string::{String, IntoString}; use string::{String, IntoString};

View file

@ -149,9 +149,9 @@ macro_rules! bitflags {
#[inline] #[inline]
pub fn from_bits(bits: $T) -> ::std::option::Option<$BitFlags> { pub fn from_bits(bits: $T) -> ::std::option::Option<$BitFlags> {
if (bits & !$BitFlags::all().bits()) != 0 { if (bits & !$BitFlags::all().bits()) != 0 {
::std::option::None ::std::option::Option::None
} else { } 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)] #[allow(non_upper_case_globals)]
mod tests { mod tests {
use hash; use hash;
use option::{Some, None}; use option::Option::{Some, None};
use ops::{BitOr, BitAnd, BitXor, Sub, Not}; use ops::{BitOr, BitAnd, BitXor, Sub, Not};
bitflags! { bitflags! {

View file

@ -38,7 +38,8 @@
use kinds::Send; use kinds::Send;
use mem; use mem;
use ops::Drop; use ops::Drop;
use option::{Option, Some, None}; use option::Option;
use option::Option::{Some, None};
use ptr::RawPtr; use ptr::RawPtr;
use ptr; use ptr;
use raw; use raw;

View file

@ -25,8 +25,10 @@ use kinds::Sized;
use mem::{mod, replace}; use mem::{mod, replace};
use num::{Int, UnsignedInt}; use num::{Int, UnsignedInt};
use ops::{Deref, Index, IndexMut}; use ops::{Deref, Index, IndexMut};
use option::{Some, None, Option}; use option::Option;
use result::{Result, Ok, Err}; use option::Option::{Some, None};
use result::Result;
use result::Result::{Ok, Err};
use super::table; use super::table;
use super::table::{ use super::table::{

View file

@ -19,8 +19,8 @@ use fmt;
use hash::{Hash, Hasher, RandomSipHasher}; use hash::{Hash, Hasher, RandomSipHasher};
use iter::{Iterator, IteratorExt, FromIterator, FilterMap, Chain, Repeat, Zip, Extend, repeat}; use iter::{Iterator, IteratorExt, FromIterator, FilterMap, Chain, Repeat, Zip, Extend, repeat};
use iter; use iter;
use option::{Some, None}; use option::Option::{Some, None};
use result::{Ok, Err}; use result::Result::{Ok, Err};
use super::map::{HashMap, Entries, MoveEntries, INITIAL_CAPACITY}; use super::map::{HashMap, Entries, MoveEntries, INITIAL_CAPACITY};

View file

@ -21,7 +21,8 @@ use mem::{min_align_of, size_of};
use mem; use mem;
use num::{Int, UnsignedInt}; use num::{Int, UnsignedInt};
use ops::{Deref, DerefMut, Drop}; 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::{RawPtr, copy_nonoverlapping_memory, zero_memory};
use ptr; use ptr;
use rt::heap::{allocate, deallocate}; use rt::heap::{allocate, deallocate};

View file

@ -44,10 +44,11 @@ use hash::Hash;
use iter::{range, Iterator, Extend}; use iter::{range, Iterator, Extend};
use mem; use mem;
use ops::Drop; use ops::Drop;
use option::{Some, None, Option}; use option::Option;
use option::Option::{Some, None};
use boxed::Box; use boxed::Box;
use ptr; use ptr;
use result::{Ok, Err}; use result::Result::{Ok, Err};
// FIXME(conventions): implement iterators? // FIXME(conventions): implement iterators?
// FIXME(conventions): implement indexing? // FIXME(conventions): implement indexing?

View file

@ -280,7 +280,8 @@ pub mod dl {
use libc; use libc;
use os; use os;
use ptr; use ptr;
use result::{Ok, Err, Result}; use result::Result;
use result::Result::{Ok, Err};
use slice::SlicePrelude; use slice::SlicePrelude;
use str::StrPrelude; use str::StrPrelude;
use str; use str;

View file

@ -78,7 +78,8 @@
//! } //! }
//! ``` //! ```
use option::{Option, None}; use option::Option;
use option::Option::None;
use kinds::Send; use kinds::Send;
use string::String; use string::String;

View file

@ -16,8 +16,9 @@ use cell::RefCell;
use fmt; use fmt;
use io::{Writer, IoResult}; use io::{Writer, IoResult};
use kinds::Send; use kinds::Send;
use option::{Some, None, Option}; use option::Option;
use result::Ok; use option::Option::{Some, None};
use result::Result::Ok;
use rt::backtrace; use rt::backtrace;
use rustrt::{Stderr, Stdio}; use rustrt::{Stderr, Stdio};
use rustrt::local::Local; use rustrt::local::Local;

View file

@ -406,7 +406,7 @@
use io::Writer; use io::Writer;
use io; use io;
use result::{Ok, Err}; use result::Result::{Ok, Err};
use string; use string;
use vec::Vec; use vec::Vec;

View file

@ -16,8 +16,9 @@ use cmp;
use io::{Reader, Writer, Stream, Buffer, DEFAULT_BUF_SIZE, IoResult}; use io::{Reader, Writer, Stream, Buffer, DEFAULT_BUF_SIZE, IoResult};
use iter::ExactSizeIterator; use iter::ExactSizeIterator;
use ops::Drop; use ops::Drop;
use option::{Some, None, Option}; use option::Option;
use result::{Ok, Err}; use option::Option::{Some, None};
use result::Result::{Ok, Err};
use slice::{SlicePrelude}; use slice::{SlicePrelude};
use slice; use slice;
use vec::Vec; use vec::Vec;

View file

@ -12,8 +12,8 @@ use clone::Clone;
use cmp; use cmp;
use comm::{Sender, Receiver}; use comm::{Sender, Receiver};
use io; use io;
use option::{None, Some}; use option::Option::{None, Some};
use result::{Ok, Err}; use result::Result::{Ok, Err};
use slice::{bytes, CloneSliceAllocPrelude, SlicePrelude}; use slice::{bytes, CloneSliceAllocPrelude, SlicePrelude};
use super::{Buffer, Reader, Writer, IoResult}; use super::{Buffer, Reader, Writer, IoResult};
use vec::Vec; use vec::Vec;

View file

@ -19,9 +19,10 @@ use io::{IoError, IoResult, Reader};
use io; use io;
use iter::Iterator; use iter::Iterator;
use num::Int; use num::Int;
use option::{Option, Some, None}; use option::Option;
use option::Option::{Some, None};
use ptr::RawPtr; use ptr::RawPtr;
use result::{Ok, Err}; use result::Result::{Ok, Err};
use slice::{SlicePrelude, AsSlice}; use slice::{SlicePrelude, AsSlice};
/// An iterator that reads a single byte on each iteration, /// An iterator that reads a single byte on each iteration,

View file

@ -59,10 +59,11 @@ use io::{Read, Truncate, ReadWrite, Append};
use io::UpdateIoError; use io::UpdateIoError;
use io; use io;
use iter::{Iterator, Extend}; use iter::{Iterator, Extend};
use option::{Some, None, Option}; use option::Option;
use option::Option::{Some, None};
use path::{Path, GenericPath}; use path::{Path, GenericPath};
use path; use path;
use result::{Err, Ok}; use result::Result::{Err, Ok};
use slice::SlicePrelude; use slice::SlicePrelude;
use string::String; use string::String;
use vec::Vec; use vec::Vec;

View file

@ -15,8 +15,8 @@
#![allow(deprecated)] #![allow(deprecated)]
use cmp::min; use cmp::min;
use option::None; use option::Option::None;
use result::{Err, Ok}; use result::Result::{Err, Ok};
use io; use io;
use io::{Reader, Writer, Seek, Buffer, IoError, SeekStyle, IoResult}; use io::{Reader, Writer, Seek, Buffer, IoError, SeekStyle, IoResult};
use slice::{mod, AsSlice, SlicePrelude}; use slice::{mod, AsSlice, SlicePrelude};

View file

@ -233,10 +233,12 @@ use int;
use iter::{Iterator, IteratorExt}; use iter::{Iterator, IteratorExt};
use mem::transmute; use mem::transmute;
use ops::{BitOr, BitXor, BitAnd, Sub, Not}; use ops::{BitOr, BitXor, BitAnd, Sub, Not};
use option::{Option, Some, None}; use option::Option;
use option::Option::{Some, None};
use os; use os;
use boxed::Box; use boxed::Box;
use result::{Ok, Err, Result}; use result::Result;
use result::Result::{Ok, Err};
use sys; use sys;
use slice::{AsSlice, SlicePrelude}; use slice::{AsSlice, SlicePrelude};
use str::{Str, StrPrelude}; use str::{Str, StrPrelude};

View file

@ -22,7 +22,8 @@ pub use self::Protocol::*;
use iter::IteratorExt; use iter::IteratorExt;
use io::{IoResult}; use io::{IoResult};
use io::net::ip::{SocketAddr, IpAddr}; use io::net::ip::{SocketAddr, IpAddr};
use option::{Option, Some, None}; use option::Option;
use option::Option::{Some, None};
use sys; use sys;
use vec::Vec; use vec::Vec;

View file

@ -21,8 +21,9 @@ use fmt;
use io::{mod, IoResult, IoError}; use io::{mod, IoResult, IoError};
use io::net; use io::net;
use iter::{Iterator, IteratorExt}; use iter::{Iterator, IteratorExt};
use option::{Option, None, Some}; use option::Option;
use result::{Ok, Err}; use option::Option::{None, Some};
use result::Result::{Ok, Err};
use str::{FromStr, StrPrelude}; use str::{FromStr, StrPrelude};
use slice::{CloneSlicePrelude, SlicePrelude}; use slice::{CloneSlicePrelude, SlicePrelude};
use vec::Vec; use vec::Vec;

View file

@ -11,8 +11,8 @@
//! Networking I/O //! Networking I/O
use io::{IoError, IoResult, InvalidInput}; use io::{IoError, IoResult, InvalidInput};
use option::None; use option::Option::None;
use result::{Ok, Err}; use result::Result::{Ok, Err};
use self::ip::{SocketAddr, ToSocketAddr}; use self::ip::{SocketAddr, ToSocketAddr};
pub use self::addrinfo::get_host_addresses; pub use self::addrinfo::get_host_addresses;

View file

@ -19,11 +19,12 @@
use clone::Clone; use clone::Clone;
use io::IoResult; use io::IoResult;
use result::Err; use result::Result::Err;
use io::net::ip::{SocketAddr, ToSocketAddr}; use io::net::ip::{SocketAddr, ToSocketAddr};
use io::{Reader, Writer, Listener, Acceptor}; use io::{Reader, Writer, Listener, Acceptor};
use io::{standard_error, TimedOut}; use io::{standard_error, TimedOut};
use option::{None, Some, Option}; use option::Option;
use option::Option::{None, Some};
use time::Duration; use time::Duration;
use sys::tcp::TcpStream as TcpStreamImp; use sys::tcp::TcpStream as TcpStreamImp;

View file

@ -19,7 +19,7 @@ use clone::Clone;
use io::net::ip::{SocketAddr, IpAddr, ToSocketAddr}; use io::net::ip::{SocketAddr, IpAddr, ToSocketAddr};
use io::{Reader, Writer, IoResult}; use io::{Reader, Writer, IoResult};
use option::Option; use option::Option;
use result::{Ok, Err}; use result::Result::{Ok, Err};
use sys::udp::UdpSocket as UdpSocketImp; use sys::udp::UdpSocket as UdpSocketImp;
use sys_common; use sys_common;

View file

@ -15,7 +15,7 @@
//! as a `Reader` without unwrapping the result first. //! as a `Reader` without unwrapping the result first.
use clone::Clone; use clone::Clone;
use result::{Ok, Err}; use result::Result::{Ok, Err};
use super::{Reader, Writer, Listener, Acceptor, Seek, SeekStyle, IoResult}; use super::{Reader, Writer, Listener, Acceptor, Seek, SeekStyle, IoResult};
impl<W: Writer> Writer for IoResult<W> { impl<W: Writer> Writer for IoResult<W> {

View file

@ -37,9 +37,10 @@ use io::{Reader, Writer, IoResult, IoError, OtherIoError, Buffer,
use kinds::Send; use kinds::Send;
use libc; use libc;
use mem; use mem;
use option::{Option, Some, None}; use option::Option;
use option::Option::{Some, None};
use ops::{Deref, DerefMut}; use ops::{Deref, DerefMut};
use result::{Ok, Err}; use result::Result::{Ok, Err};
use rustrt; use rustrt;
use rustrt::local::Local; use rustrt::local::Local;
use rustrt::task::Task; use rustrt::task::Task;

View file

@ -14,10 +14,11 @@ use io::{fs, IoResult};
use io; use io;
use libc; use libc;
use ops::Drop; use ops::Drop;
use option::{Option, None, Some}; use option::Option;
use option::Option::{None, Some};
use os; use os;
use path::{Path, GenericPath}; use path::{Path, GenericPath};
use result::{Ok, Err}; use result::Result::{Ok, Err};
use sync::atomic; use sync::atomic;
/// A wrapper for a path to temporary directory implementing automatic /// A wrapper for a path to temporary directory implementing automatic

View file

@ -40,14 +40,16 @@ use libc::{c_void, c_int};
use libc; use libc;
use boxed::Box; use boxed::Box;
use ops::Drop; use ops::Drop;
use option::{Some, None, Option}; use option::Option;
use option::Option::{Some, None};
use os; use os;
use path::{Path, GenericPath, BytesContainer}; use path::{Path, GenericPath, BytesContainer};
use sys; use sys;
use sys::os as os_imp; use sys::os as os_imp;
use ptr::RawPtr; use ptr::RawPtr;
use ptr; use ptr;
use result::{Err, Ok, Result}; use result::Result;
use result::Result::{Err, Ok};
use slice::{AsSlice, SlicePrelude, PartialEqSlicePrelude}; use slice::{AsSlice, SlicePrelude, PartialEqSlicePrelude};
use slice::CloneSliceAllocPrelude; use slice::CloneSliceAllocPrelude;
use str::{Str, StrPrelude, StrAllocating}; use str::{Str, StrPrelude, StrAllocating};
@ -160,7 +162,8 @@ pub fn getcwd() -> IoResult<Path> {
pub mod windows { pub mod windows {
use libc::types::os::arch::extra::DWORD; use libc::types::os::arch::extra::DWORD;
use libc; use libc;
use option::{None, Option}; use option::Option;
use option::Option::None;
use option; use option;
use os::TMPBUF_SZ; use os::TMPBUF_SZ;
use slice::{SlicePrelude}; use slice::{SlicePrelude};
@ -196,7 +199,7 @@ pub mod windows {
// set `res` to None and continue. // set `res` to None and continue.
let s = String::from_utf16(sub) let s = String::from_utf16(sub)
.expect("fill_utf16_buf_and_decode: closure created invalid UTF-16"); .expect("fill_utf16_buf_and_decode: closure created invalid UTF-16");
res = option::Some(s) res = option::Option::Some(s)
} }
} }
return res; return res;
@ -1797,7 +1800,7 @@ mod tests {
fn test_setenv() { fn test_setenv() {
let n = make_rand_name(); let n = make_rand_name();
setenv(n.as_slice(), "VALUE"); 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] #[test]
@ -1805,7 +1808,7 @@ mod tests {
let n = make_rand_name(); let n = make_rand_name();
setenv(n.as_slice(), "VALUE"); setenv(n.as_slice(), "VALUE");
unsetenv(n.as_slice()); unsetenv(n.as_slice());
assert_eq!(getenv(n.as_slice()), option::None); assert_eq!(getenv(n.as_slice()), option::Option::None);
} }
#[test] #[test]
@ -1814,9 +1817,9 @@ mod tests {
let n = make_rand_name(); let n = make_rand_name();
setenv(n.as_slice(), "1"); setenv(n.as_slice(), "1");
setenv(n.as_slice(), "2"); 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(), ""); 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 // Windows GetEnvironmentVariable requires some extra work to make sure
@ -1833,7 +1836,7 @@ mod tests {
let n = make_rand_name(); let n = make_rand_name();
setenv(n.as_slice(), s.as_slice()); setenv(n.as_slice(), s.as_slice());
debug!("{}", s.clone()); debug!("{}", s.clone());
assert_eq!(getenv(n.as_slice()), option::Some(s)); assert_eq!(getenv(n.as_slice()), option::Option::Some(s));
} }
#[test] #[test]
@ -1870,7 +1873,7 @@ mod tests {
// MingW seems to set some funky environment variables like // MingW seems to set some funky environment variables like
// "=C:=C:\MinGW\msys\1.0\bin" and "!::=::\" that are returned // "=C:=C:\MinGW\msys\1.0\bin" and "!::=::\" that are returned
// from env() but not visible from getenv(). // from env() but not visible from getenv().
assert!(v2.is_none() || v2 == option::Some(v)); assert!(v2.is_none() || v2 == option::Option::Some(v));
} }
} }
@ -1957,7 +1960,7 @@ mod tests {
#[test] #[test]
fn memory_map_rw() { fn memory_map_rw() {
use result::{Ok, Err}; use result::Result::{Ok, Err};
let chunk = match os::MemoryMap::new(16, &[ let chunk = match os::MemoryMap::new(16, &[
os::MapReadable, os::MapReadable,
@ -1976,7 +1979,7 @@ mod tests {
#[test] #[test]
fn memory_map_file() { fn memory_map_file() {
use result::{Ok, Err}; use result::Result::{Ok, Err};
use os::*; use os::*;
use libc::*; use libc::*;
use io::fs; use io::fs;

View file

@ -66,7 +66,8 @@ use c_str::CString;
use clone::Clone; use clone::Clone;
use fmt; use fmt;
use iter::IteratorExt; use iter::IteratorExt;
use option::{Option, None, Some}; use option::Option;
use option::Option::{None, Some};
use str; use str;
use str::{CowString, MaybeOwned, Str, StrPrelude}; use str::{CowString, MaybeOwned, Str, StrPrelude};
use string::String; use string::String;

View file

@ -17,7 +17,8 @@ use hash;
use io::Writer; use io::Writer;
use iter::{DoubleEndedIteratorExt, AdditiveIterator, Extend}; use iter::{DoubleEndedIteratorExt, AdditiveIterator, Extend};
use iter::{Iterator, IteratorExt, Map}; use iter::{Iterator, IteratorExt, Map};
use option::{Option, None, Some}; use option::Option;
use option::Option::{None, Some};
use kinds::Sized; use kinds::Sized;
use str::{FromStr, Str}; use str::{FromStr, Str};
use str; use str;

View file

@ -23,7 +23,8 @@ use io::Writer;
use iter::{AdditiveIterator, DoubleEndedIteratorExt, Extend}; use iter::{AdditiveIterator, DoubleEndedIteratorExt, Extend};
use iter::{Iterator, IteratorExt, Map}; use iter::{Iterator, IteratorExt, Map};
use mem; use mem;
use option::{Option, Some, None}; use option::Option;
use option::Option::{Some, None};
use slice::{AsSlice, SlicePrelude}; use slice::{AsSlice, SlicePrelude};
use str::{CharSplits, FromStr, Str, StrAllocating, StrVector, StrPrelude}; use str::{CharSplits, FromStr, Str, StrAllocating, StrVector, StrPrelude};
use string::String; use string::String;

View file

@ -227,7 +227,7 @@ use io::IoResult;
use iter::{Iterator, IteratorExt}; use iter::{Iterator, IteratorExt};
use mem; use mem;
use rc::Rc; use rc::Rc;
use result::{Ok, Err}; use result::Result::{Ok, Err};
use vec::Vec; use vec::Vec;
#[cfg(not(target_word_size="64"))] #[cfg(not(target_word_size="64"))]

View file

@ -23,7 +23,7 @@ mod imp {
use path::Path; use path::Path;
use rand::Rng; use rand::Rng;
use rand::reader::ReaderRng; use rand::reader::ReaderRng;
use result::{Ok, Err}; use result::Result::{Ok, Err};
use slice::SlicePrelude; use slice::SlicePrelude;
use mem; use mem;
use os::errno; use os::errno;
@ -173,7 +173,7 @@ mod imp {
use mem; use mem;
use os; use os;
use rand::Rng; use rand::Rng;
use result::{Ok}; use result::Result::{Ok};
use self::libc::{c_int, size_t}; use self::libc::{c_int, size_t};
use slice::{SlicePrelude}; use slice::{SlicePrelude};
@ -240,7 +240,7 @@ mod imp {
use ops::Drop; use ops::Drop;
use os; use os;
use rand::Rng; use rand::Rng;
use result::{Ok, Err}; use result::Result::{Ok, Err};
use self::libc::{DWORD, BYTE, LPCSTR, BOOL}; use self::libc::{DWORD, BYTE, LPCSTR, BOOL};
use self::libc::types::os::arch::extra::{LONG_PTR}; use self::libc::types::os::arch::extra::{LONG_PTR};
use slice::{SlicePrelude}; use slice::{SlicePrelude};

View file

@ -12,7 +12,7 @@
use io::Reader; use io::Reader;
use rand::Rng; use rand::Rng;
use result::{Ok, Err}; use result::Result::{Ok, Err};
use slice::SlicePrelude; use slice::SlicePrelude;
/// An RNG that reads random bytes straight from a `Reader`. This will /// An RNG that reads random bytes straight from a `Reader`. This will

View file

@ -14,9 +14,9 @@
use io::{IoResult, Writer}; use io::{IoResult, Writer};
use iter::{Iterator, IteratorExt}; use iter::{Iterator, IteratorExt};
use option::{Some, None}; use option::Option::{Some, None};
use os; use os;
use result::{Ok, Err}; use result::Result::{Ok, Err};
use str::{StrPrelude, from_str}; use str::{StrPrelude, from_str};
use sync::atomic; use sync::atomic;
use unicode::char::UnicodeChar; use unicode::char::UnicodeChar;
@ -236,8 +236,9 @@ mod imp {
use io::{IoResult, Writer}; use io::{IoResult, Writer};
use libc; use libc;
use mem; use mem;
use option::{Some, None, Option}; use option::Option;
use result::{Ok, Err}; use option::Option::{Some, None};
use result::Result::{Ok, Err};
use sync::{StaticMutex, MUTEX_INIT}; use sync::{StaticMutex, MUTEX_INIT};
/// As always - iOS on arm uses SjLj exceptions and /// As always - iOS on arm uses SjLj exceptions and
@ -664,9 +665,9 @@ mod imp {
use libc; use libc;
use mem; use mem;
use ops::Drop; use ops::Drop;
use option::{Some, None}; use option::Option::{Some, None};
use path::Path; use path::Path;
use result::{Ok, Err}; use result::Result::{Ok, Err};
use sync::{StaticMutex, MUTEX_INIT}; use sync::{StaticMutex, MUTEX_INIT};
use slice::SlicePrelude; use slice::SlicePrelude;
use str::StrPrelude; use str::StrPrelude;

View file

@ -9,7 +9,8 @@
// except according to those terms. // except according to those terms.
use libc::uintptr_t; use libc::uintptr_t;
use option::{Some, None, Option}; use option::Option;
use option::Option::{Some, None};
use os; use os;
use str::{FromStr, from_str, Str}; use str::{FromStr, from_str, Str};
use sync::atomic; use sync::atomic;

View file

@ -20,7 +20,7 @@ use prelude::*;
use io::{FilePermission, Write, UnstableFileStat, Open, FileAccess, FileMode}; use io::{FilePermission, Write, UnstableFileStat, Open, FileAccess, FileMode};
use io::{IoResult, FileStat, SeekStyle, Reader}; use io::{IoResult, FileStat, SeekStyle, Reader};
use io::{Read, Truncate, SeekCur, SeekSet, ReadWrite, SeekEnd, Append}; use io::{Read, Truncate, SeekCur, SeekSet, ReadWrite, SeekEnd, Append};
use result::{Ok, Err}; use result::Result::{Ok, Err};
use sys::retry; use sys::retry;
use sys_common::{keep_going, eof, mkerr_libc}; use sys_common::{keep_going, eof, mkerr_libc};

View file

@ -49,7 +49,8 @@ use boxed::Box;
use comm::channel; use comm::channel;
use io::{Writer, stdio}; use io::{Writer, stdio};
use kinds::{Send, marker}; use kinds::{Send, marker};
use option::{None, Some, Option}; use option::Option;
use option::Option::{None, Some};
use result::Result; use result::Result;
use rustrt::local::Local; use rustrt::local::Local;
use rustrt::task::Task; use rustrt::task::Task;
@ -172,9 +173,10 @@ impl TaskBuilder {
/// # Return value /// # Return value
/// ///
/// If the child task executes successfully (without panicking) then the /// If the child task executes successfully (without panicking) then the
/// future returns `result::Ok` containing the value returned by the /// future returns `result::Result::Ok` containing the value returned by the
/// function. If the child task panics then the future returns `result::Err` /// function. If the child task panics then the future returns
/// containing the argument to `panic!(...)` as an `Any` trait object. /// `result::Result::Err` containing the argument to `panic!(...)` as an
/// `Any` trait object.
#[experimental = "Futures are experimental."] #[experimental = "Futures are experimental."]
pub fn try_future<T:Send>(self, f: proc():Send -> T) pub fn try_future<T:Send>(self, f: proc():Send -> T)
-> Future<Result<T, Box<Any + Send>>> { -> Future<Result<T, Box<Any + Send>>> {
@ -268,7 +270,7 @@ mod test {
use borrow::IntoCow; use borrow::IntoCow;
use boxed::BoxAny; use boxed::BoxAny;
use prelude::*; use prelude::*;
use result::{Ok, Err}; use result::Result::{Ok, Err};
use result; use result;
use std::io::{ChanReader, ChanWriter}; use std::io::{ChanReader, ChanWriter};
use string::String; use string::String;
@ -330,7 +332,7 @@ mod test {
match try(proc() { match try(proc() {
"Success!".to_string() "Success!".to_string()
}).as_ref().map(|s| s.as_slice()) { }).as_ref().map(|s| s.as_slice()) {
result::Ok("Success!") => (), result::Result::Ok("Success!") => (),
_ => panic!() _ => panic!()
} }
} }
@ -340,8 +342,8 @@ mod test {
match try(proc() { match try(proc() {
panic!() panic!()
}) { }) {
result::Err(_) => (), result::Result::Err(_) => (),
result::Ok(()) => panic!() result::Result::Ok(()) => panic!()
} }
} }

View file

@ -115,7 +115,7 @@ macro_rules! thread_local(
use std::cell::UnsafeCell as __UnsafeCell; use std::cell::UnsafeCell as __UnsafeCell;
use std::thread_local::KeyInner as __KeyInner; use std::thread_local::KeyInner as __KeyInner;
use std::option::Option as __Option; 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>> = { __thread_local_inner!(static __KEY: __UnsafeCell<__Option<$t>> = {
__UnsafeCell { value: __None } __UnsafeCell { value: __None }
@ -132,7 +132,7 @@ macro_rules! thread_local(
use std::cell::UnsafeCell as __UnsafeCell; use std::cell::UnsafeCell as __UnsafeCell;
use std::thread_local::KeyInner as __KeyInner; use std::thread_local::KeyInner as __KeyInner;
use std::option::Option as __Option; 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>> = { __thread_local_inner!(static __KEY: __UnsafeCell<__Option<$t>> = {
__UnsafeCell { value: __None } __UnsafeCell { value: __None }
@ -198,7 +198,7 @@ macro_rules! __thread_local_inner(
inner: ::std::cell::UnsafeCell { value: $init }, inner: ::std::cell::UnsafeCell { value: $init },
os: ::std::thread_local::OsStaticKey { os: ::std::thread_local::OsStaticKey {
inner: ::std::thread_local::OS_INIT_INNER, inner: ::std::thread_local::OS_INIT_INNER,
dtor: ::std::option::Some(__destroy), dtor: ::std::option::Option::Some(__destroy),
}, },
} }
}; };

View file

@ -14,9 +14,11 @@
use {fmt, i64}; use {fmt, i64};
use ops::{Add, Sub, Mul, Div, Neg}; use ops::{Add, Sub, Mul, Div, Neg};
use option::{Option, Some, None}; use option::Option;
use option::Option::{Some, None};
use num::Int; use num::Int;
use result::{Result, Ok, Err}; use result::Result;
use result::Result::{Ok, Err};
/// The number of nanoseconds in a microsecond. /// The number of nanoseconds in a microsecond.
const NANOS_PER_MICRO: i32 = 1000; const NANOS_PER_MICRO: i32 = 1000;
@ -387,7 +389,7 @@ fn div_rem_64(this: i64, other: i64) -> (i64, i64) {
mod tests { mod tests {
use super::{Duration, MIN, MAX}; use super::{Duration, MIN, MAX};
use {i32, i64}; use {i32, i64};
use option::{Some, None}; use option::Option::{Some, None};
use string::ToString; use string::ToString;
#[test] #[test]

View file

@ -680,6 +680,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
let some = vec!( let some = vec!(
self.ident_of("std"), self.ident_of("std"),
self.ident_of("option"), self.ident_of("option"),
self.ident_of("Option"),
self.ident_of("Some")); self.ident_of("Some"));
self.expr_call_global(sp, some, vec!(expr)) 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!( let none = self.path_global(sp, vec!(
self.ident_of("std"), self.ident_of("std"),
self.ident_of("option"), self.ident_of("option"),
self.ident_of("Option"),
self.ident_of("None"))); self.ident_of("None")));
self.expr_path(none) self.expr_path(none)
} }
@ -732,6 +734,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
let ok = vec!( let ok = vec!(
self.ident_of("std"), self.ident_of("std"),
self.ident_of("result"), self.ident_of("result"),
self.ident_of("Result"),
self.ident_of("Ok")); self.ident_of("Ok"));
self.expr_call_global(sp, ok, vec!(expr)) self.expr_call_global(sp, ok, vec!(expr))
} }
@ -740,6 +743,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
let err = vec!( let err = vec!(
self.ident_of("std"), self.ident_of("std"),
self.ident_of("result"), self.ident_of("result"),
self.ident_of("Result"),
self.ident_of("Err")); self.ident_of("Err"));
self.expr_call_global(sp, err, vec!(expr)) self.expr_call_global(sp, err, vec!(expr))
} }
@ -810,6 +814,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
let some = vec!( let some = vec!(
self.ident_of("std"), self.ident_of("std"),
self.ident_of("option"), self.ident_of("option"),
self.ident_of("Option"),
self.ident_of("Some")); self.ident_of("Some"));
let path = self.path_global(span, some); let path = self.path_global(span, some);
self.pat_enum(span, path, vec!(pat)) self.pat_enum(span, path, vec!(pat))
@ -819,6 +824,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
let some = vec!( let some = vec!(
self.ident_of("std"), self.ident_of("std"),
self.ident_of("option"), self.ident_of("option"),
self.ident_of("Option"),
self.ident_of("None")); self.ident_of("None"));
let path = self.path_global(span, some); let path = self.path_global(span, some);
self.pat_enum(span, path, vec!()) self.pat_enum(span, path, vec!())
@ -828,6 +834,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
let some = vec!( let some = vec!(
self.ident_of("std"), self.ident_of("std"),
self.ident_of("result"), self.ident_of("result"),
self.ident_of("Result"),
self.ident_of("Ok")); self.ident_of("Ok"));
let path = self.path_global(span, some); let path = self.path_global(span, some);
self.pat_enum(span, path, vec!(pat)) self.pat_enum(span, path, vec!(pat))
@ -837,6 +844,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
let some = vec!( let some = vec!(
self.ident_of("std"), self.ident_of("std"),
self.ident_of("result"), self.ident_of("result"),
self.ident_of("Result"),
self.ident_of("Err")); self.ident_of("Err"));
let path = self.path_global(span, some); let path = self.path_global(span, some);
self.pat_enum(span, path, vec!(pat)) self.pat_enum(span, path, vec!(pat))

View file

@ -105,6 +105,7 @@ pub fn cs_partial_cmp(cx: &mut ExtCtxt, span: Span,
let ordering = cx.path_global(span, let ordering = cx.path_global(span,
vec!(cx.ident_of("std"), vec!(cx.ident_of("std"),
cx.ident_of("cmp"), cx.ident_of("cmp"),
cx.ident_of("Ordering"),
cx.ident_of("Equal"))); cx.ident_of("Equal")));
let ordering = cx.expr_path(ordering); let ordering = cx.expr_path(ordering);
let equals_expr = cx.expr_some(span, ordering); let equals_expr = cx.expr_some(span, ordering);
@ -120,9 +121,9 @@ pub fn cs_partial_cmp(cx: &mut ExtCtxt, span: Span,
Builds: Builds:
let __test = ::std::cmp::PartialOrd::partial_cmp(&self_field1, &other_field1); 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); 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 { } else {
__test __test
@ -139,7 +140,7 @@ pub fn cs_partial_cmp(cx: &mut ExtCtxt, span: Span,
false, false,
|cx, span, old, self_f, other_fs| { |cx, span, old, self_f, other_fs| {
// let __test = new; // let __test = new;
// if __test == Some(::std::cmp::Equal) { // if __test == Some(::std::cmp::Ordering::Equal) {
// old // old
// } else { // } else {
// __test // __test

View file

@ -70,9 +70,9 @@ pub fn cs_cmp(cx: &mut ExtCtxt, span: Span,
Builds: Builds:
let __test = self_field1.cmp(&other_field2); 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); let __test = self_field2.cmp(&other_field2);
if __test == ::std::cmp::Equal { if __test == ::std::cmp::Ordering::Equal {
... ...
} else { } else {
__test __test
@ -89,7 +89,7 @@ pub fn cs_cmp(cx: &mut ExtCtxt, span: Span,
false, false,
|cx, span, old, new| { |cx, span, old, new| {
// let __test = new; // let __test = new;
// if __test == ::std::cmp::Equal { // if __test == ::std::cmp::Ordering::Equal {
// old // old
// } else { // } else {
// __test // __test

View file

@ -36,6 +36,7 @@ pub fn expand_option_env<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenT
true, true,
vec!(cx.ident_of("std"), vec!(cx.ident_of("std"),
cx.ident_of("option"), cx.ident_of("option"),
cx.ident_of("Option"),
cx.ident_of("None")), cx.ident_of("None")),
Vec::new(), Vec::new(),
vec!(cx.ty_rptr(sp, 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, cx.expr_call_global(sp,
vec!(cx.ident_of("std"), vec!(cx.ident_of("std"),
cx.ident_of("option"), cx.ident_of("option"),
cx.ident_of("Option"),
cx.ident_of("Some")), cx.ident_of("Some")),
vec!(cx.expr_str(sp, vec!(cx.expr_str(sp,
token::intern_and_get_ident( token::intern_and_get_ident(

View file

@ -576,7 +576,7 @@ fn format(val: Param, op: FormatOp, flags: Flags) -> Result<Vec<u8> ,String> {
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use super::{expand,Param,Words,Variables,Number}; use super::{expand,Param,Words,Variables,Number};
use std::result::Ok; use std::result::Result::Ok;
#[test] #[test]
fn test_basic_setabf() { fn test_basic_setabf() {

View file

@ -1262,7 +1262,7 @@ mod tests {
InvalidFormatSpecifier}; InvalidFormatSpecifier};
use std::f64; use std::f64;
use std::result::{Err, Ok}; use std::result::Result::{Err, Ok};
use std::time::Duration; use std::time::Duration;
use self::test::Bencher; use self::test::Bencher;

View file

@ -10,8 +10,9 @@
//! Functions for computing canonical and compatible decompositions for Unicode characters. //! Functions for computing canonical and compatible decompositions for Unicode characters.
use core::cmp::{Equal, Less, Greater}; use core::cmp::Ordering::{Equal, Less, Greater};
use core::option::{Option, Some, None}; use core::option::Option;
use core::option::Option::{Some, None};
use core::slice; use core::slice;
use core::slice::SlicePrelude; use core::slice::SlicePrelude;
use tables::normalization::{canonical_table, compatibility_table, composition_table}; use tables::normalization::{canonical_table, compatibility_table, composition_table};

View file

@ -17,7 +17,7 @@
pub const UNICODE_VERSION: (uint, uint, uint) = (7, 0, 0); pub const UNICODE_VERSION: (uint, uint, uint) = (7, 0, 0);
fn bsearch_range_table(c: char, r: &'static [(char,char)]) -> bool { 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; use core::slice::SlicePrelude;
r.binary_search(|&(lo,hi)| { r.binary_search(|&(lo,hi)| {
if lo <= c && c <= hi { Equal } 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 { 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::SlicePrelude;
use core::slice; use core::slice;
match r.binary_search(|&(lo, hi, _)| { match r.binary_search(|&(lo, hi, _)| {
@ -6366,10 +6366,11 @@ pub mod normalization {
} }
pub mod conversions { pub mod conversions {
use core::cmp::{Equal, Less, Greater}; use core::cmp::Ordering::{Equal, Less, Greater};
use core::slice::SlicePrelude; use core::slice::SlicePrelude;
use core::tuple::Tuple2; use core::tuple::Tuple2;
use core::option::{Option, Some, None}; use core::option::Option;
use core::option::Option::{Some, None};
use core::slice; use core::slice;
pub fn to_lower(c: char) -> char { pub fn to_lower(c: char) -> char {
@ -6934,12 +6935,13 @@ pub mod conversions {
} }
pub mod charwidth { 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::SlicePrelude;
use core::slice; use core::slice;
fn bsearch_range_value_table(c: char, is_cjk: bool, r: &'static [(char, char, u8, u8)]) -> u8 { 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, _, _)| { match r.binary_search(|&(lo, hi, _, _)| {
if lo <= c && c <= hi { Equal } if lo <= c && c <= hi { Equal }
else if hi < c { Less } 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 { 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, _)| { match r.binary_search(|&(lo, hi, _)| {
if lo <= c && c <= hi { Equal } if lo <= c && c <= hi { Equal }
else if hi < c { Less } else if hi < c { Less }

View file

@ -21,7 +21,8 @@ use core::slice::SlicePrelude;
use core::iter::{Filter, AdditiveIterator, Iterator, IteratorExt}; use core::iter::{Filter, AdditiveIterator, Iterator, IteratorExt};
use core::iter::{DoubleEndedIterator, DoubleEndedIteratorExt}; use core::iter::{DoubleEndedIterator, DoubleEndedIteratorExt};
use core::kinds::Sized; 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 core::str::{CharSplits, StrPrelude};
use u_char::UnicodeChar; use u_char::UnicodeChar;
use tables::grapheme::GraphemeCat; use tables::grapheme::GraphemeCat;

View file

@ -77,8 +77,8 @@ fn sort_and_fmt(mm: &HashMap<Vec<u8> , uint>, total: uint) -> String {
fn find(mm: &HashMap<Vec<u8> , uint>, key: String) -> uint { fn find(mm: &HashMap<Vec<u8> , uint>, key: String) -> uint {
let key = key.into_ascii().as_slice().to_lowercase().into_string(); let key = key.into_ascii().as_slice().to_lowercase().into_string();
match mm.get(key.as_bytes()) { match mm.get(key.as_bytes()) {
option::None => { return 0u; } option::Option::None => { return 0u; }
option::Some(&num) => { return num; } option::Option::Some(&num) => { return num; }
} }
} }
@ -190,8 +190,8 @@ fn main() {
// start processing if this is the one // start processing if this is the one
('>', false) => { ('>', false) => {
match line.as_slice().slice_from(1).find_str("THREE") { match line.as_slice().slice_from(1).find_str("THREE") {
option::Some(_) => { proc_mode = true; } option::Option::Some(_) => { proc_mode = true; }
option::None => { } option::Option::None => { }
} }
} }

View file

@ -21,7 +21,7 @@
extern crate getopts; extern crate getopts;
use std::os; use std::os;
use std::result::{Ok, Err}; use std::result::Result::{Ok, Err};
use std::task; use std::task;
use std::time::Duration; use std::time::Duration;

View file

@ -18,8 +18,8 @@ use std::mem::*; // shouldn't get errors for not using
// everything imported // everything imported
// Should get errors for both 'Some' and 'None' // Should get errors for both 'Some' and 'None'
use std::option::{Some, None}; //~ ERROR unused import use std::option::Option::{Some, None}; //~ ERROR unused import
//~^ ERROR unused import //~^ ERROR unused import
use test::A; //~ ERROR unused import use test::A; //~ ERROR unused import
// Be sure that if we just bring some methods into scope that they're also // Be sure that if we just bring some methods into scope that they're also

View file

@ -10,8 +10,8 @@
// error-pattern:called `Result::unwrap()` on an `Err` value // error-pattern:called `Result::unwrap()` on an `Err` value
use std::result; use std::result::Result::Err;
fn main() { fn main() {
println!("{}", result::Err::<int,String>("kitty".to_string()).unwrap()); println!("{}", Err::<int,String>("kitty".to_string()).unwrap());
} }

View file

@ -39,5 +39,5 @@ pub fn main() {
assert!(a != b); assert!(a != b);
assert!(a < b); assert!(a < b);
assert_eq!(a.cmp(&b), ::std::cmp::Less); assert_eq!(a.cmp(&b), ::std::cmp::Ordering::Less);
} }

View file

@ -10,7 +10,7 @@
// ignore-test FIXME #11820: & is unreliable in deriving // ignore-test FIXME #11820: & is unreliable in deriving
use std::cmp::{Less,Equal,Greater}; use std::cmp::Ordering::{Less,Equal,Greater};
#[deriving(Eq,Ord)] #[deriving(Eq,Ord)]
struct A<'a> { struct A<'a> {

View file

@ -8,7 +8,8 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use std::result::{Result,Ok}; use std::result::Result;
use std::result::Result::Ok;
static C: Result<(), Box<int>> = Ok(()); static C: Result<(), Box<int>> = Ok(());

View file

@ -24,14 +24,14 @@ enum object {
fn lookup(table: json::Object, key: String, default: String) -> String fn lookup(table: json::Object, key: String, default: String) -> String
{ {
match table.find(&key.to_string()) { match table.find(&key.to_string()) {
option::Some(&Json::String(ref s)) => { option::Option::Some(&Json::String(ref s)) => {
s.to_string() s.to_string()
} }
option::Some(value) => { option::Option::Some(value) => {
println!("{} was expected to be a string but is a {}", key, value); println!("{} was expected to be a string but is a {}", key, value);
default default
} }
option::None => { option::Option::None => {
default default
} }
} }

View file

@ -20,7 +20,7 @@ type rsrc_loader = proc(path: &Path):'static -> result::Result<String, String>;
fn tester() fn tester()
{ {
let loader: rsrc_loader = proc(_path) { 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"); let path = path::Path::new("blah");

View file

@ -41,9 +41,9 @@ macro_rules! check_option {
check_option!($e: $T, |ptr| assert!(*ptr == $e)); check_option!($e: $T, |ptr| assert!(*ptr == $e));
}}; }};
($e:expr: $T:ty, |$v:ident| $chk:expr) => {{ ($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 e = $e;
let s_ = option::Some::<$T>(e); let s_ = option::Option::Some::<$T>(e);
let $v = s_.as_ref().unwrap(); let $v = s_.as_ref().unwrap();
$chk $chk
}} }}

View file

@ -11,7 +11,7 @@
extern crate collections; extern crate collections;
use std::collections::HashMap; use std::collections::HashMap;
use std::option::Some; use std::option::Option::Some;
use std::str::SendStr; use std::str::SendStr;
pub fn main() { pub fn main() {

View file

@ -11,7 +11,7 @@
extern crate collections; extern crate collections;
use self::collections::TreeMap; use self::collections::TreeMap;
use std::option::Some; use std::option::Option::Some;
use std::str::SendStr; use std::str::SendStr;
use std::string::ToString; use std::string::ToString;