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:
parent
6f4c11be3b
commit
4ef16741e3
85 changed files with 277 additions and 195 deletions
|
@ -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>(_: 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.
|
||||
|
|
|
@ -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 emit_norm_module(f, canon, compat, combine, norm_props):
|
|||
|
||||
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, _)| {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -177,7 +177,8 @@ mod imp {
|
|||
|
||||
#[cfg(all(not(external_funcs), not(external_crate), 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};
|
||||
|
|
|
@ -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<T> RcBoxPtr<T> for Weak<T> {
|
|||
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;
|
||||
|
||||
|
|
|
@ -833,8 +833,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};
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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"]
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -44,7 +44,8 @@
|
|||
pub use self::Ordering::*;
|
||||
|
||||
use kinds::Sized;
|
||||
use option::{Option, Some, None};
|
||||
use option::Option;
|
||||
use option::Option::{Some, None};
|
||||
|
||||
/// Trait for values that can be compared for equality and inequality.
|
||||
///
|
||||
|
@ -288,10 +289,11 @@ pub fn partial_max<T: PartialOrd>(v1: T, v2: T) -> Option<T> {
|
|||
|
||||
// Implementation of PartialEq, Eq, PartialOrd and Ord for primitive types
|
||||
mod impls {
|
||||
use cmp::{PartialOrd, Ord, PartialEq, Eq, Ordering,
|
||||
Less, Greater, Equal};
|
||||
use cmp::{PartialOrd, Ord, PartialEq, Eq, Ordering};
|
||||
use cmp::Ordering::{Less, Greater, Equal};
|
||||
use kinds::Sized;
|
||||
use option::{Option, Some, None};
|
||||
use option::Option;
|
||||
use option::Option::{Some, None};
|
||||
|
||||
macro_rules! partial_eq_impl(
|
||||
($($t:ty)*) => ($(
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -62,7 +62,8 @@ use cmp::Ord;
|
|||
use mem;
|
||||
use num::{ToPrimitive, Int};
|
||||
use ops::{Add, Deref};
|
||||
use option::{Option, Some, None};
|
||||
use option::Option;
|
||||
use option::Option::{Some, None};
|
||||
use uint;
|
||||
|
||||
#[deprecated = "renamed to Extend"] pub use self::Extend as Extendable;
|
||||
|
@ -2458,7 +2459,9 @@ pub fn repeat<T: Clone>(elt: T) -> Repeat<T> {
|
|||
pub mod order {
|
||||
use cmp;
|
||||
use cmp::{Eq, Ord, PartialOrd, PartialEq};
|
||||
use option::{Option, Some, None};
|
||||
use cmp::Ordering::{Equal, Less, Greater};
|
||||
use option::Option;
|
||||
use option::Option::{Some, None};
|
||||
use super::Iterator;
|
||||
|
||||
/// Compare `a` and `b` for equality using `Eq`
|
||||
|
@ -2476,11 +2479,11 @@ pub mod order {
|
|||
pub fn cmp<A: Ord, T: Iterator<A>, S: Iterator<A>>(mut a: T, mut b: S) -> cmp::Ordering {
|
||||
loop {
|
||||
match (a.next(), b.next()) {
|
||||
(None, None) => return cmp::Equal,
|
||||
(None, _ ) => return cmp::Less,
|
||||
(_ , None) => return cmp::Greater,
|
||||
(None, None) => return Equal,
|
||||
(None, _ ) => return Less,
|
||||
(_ , None) => return Greater,
|
||||
(Some(x), Some(y)) => match x.cmp(&y) {
|
||||
cmp::Equal => (),
|
||||
Equal => (),
|
||||
non_eq => return non_eq,
|
||||
},
|
||||
}
|
||||
|
@ -2492,11 +2495,11 @@ pub mod order {
|
|||
-> Option<cmp::Ordering> {
|
||||
loop {
|
||||
match (a.next(), b.next()) {
|
||||
(None, None) => return Some(cmp::Equal),
|
||||
(None, _ ) => return Some(cmp::Less),
|
||||
(_ , None) => return Some(cmp::Greater),
|
||||
(None, None) => return Some(Equal),
|
||||
(None, _ ) => return Some(Less),
|
||||
(_ , None) => return Some(Greater),
|
||||
(Some(x), Some(y)) => match x.partial_cmp(&y) {
|
||||
Some(cmp::Equal) => (),
|
||||
Some(Equal) => (),
|
||||
non_eq => return non_eq,
|
||||
},
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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`).
|
||||
///
|
||||
|
|
|
@ -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).
|
||||
|
|
|
@ -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};
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -48,7 +48,8 @@ pub fn test_num<T>(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;
|
||||
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,8 +15,7 @@ use middle::infer;
|
|||
use middle::infer::resolve_type;
|
||||
use middle::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;
|
||||
|
@ -38,8 +37,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);
|
||||
}
|
||||
}
|
||||
|
@ -69,8 +68,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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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! {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -25,8 +25,10 @@ use kinds::Sized;
|
|||
use mem::{mod, replace};
|
||||
use num::{Int, 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::{
|
||||
|
|
|
@ -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};
|
||||
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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?
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -78,7 +78,8 @@
|
|||
//! }
|
||||
//! ```
|
||||
|
||||
use option::{Option, None};
|
||||
use option::Option;
|
||||
use option::Option::None;
|
||||
use kinds::Send;
|
||||
use string::String;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -406,7 +406,7 @@
|
|||
|
||||
use io::Writer;
|
||||
use io;
|
||||
use result::{Ok, Err};
|
||||
use result::Result::{Ok, Err};
|
||||
use string;
|
||||
use vec::Vec;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -59,10 +59,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;
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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<W: Writer> Writer for IoResult<W> {
|
||||
|
|
|
@ -37,9 +37,10 @@ use io::{Reader, Writer, IoResult, IoError, OtherIoError, Buffer,
|
|||
use kinds::Send;
|
||||
use libc;
|
||||
use mem;
|
||||
use option::{Option, Some, None};
|
||||
use option::Option;
|
||||
use option::Option::{Some, None};
|
||||
use ops::{Deref, DerefMut};
|
||||
use result::{Ok, Err};
|
||||
use result::Result::{Ok, Err};
|
||||
use rustrt;
|
||||
use rustrt::local::Local;
|
||||
use rustrt::task::Task;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<Path> {
|
|||
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;
|
||||
|
@ -1797,7 +1800,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]
|
||||
|
@ -1805,7 +1808,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]
|
||||
|
@ -1814,9 +1817,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
|
||||
|
@ -1833,7 +1836,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]
|
||||
|
@ -1870,7 +1873,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));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1957,7 +1960,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,
|
||||
|
@ -1976,7 +1979,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn memory_map_file() {
|
||||
use result::{Ok, Err};
|
||||
use result::Result::{Ok, Err};
|
||||
use os::*;
|
||||
use libc::*;
|
||||
use io::fs;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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"))]
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 sync::{StaticMutex, 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 sync::{StaticMutex, MUTEX_INIT};
|
||||
use slice::SlicePrelude;
|
||||
use str::StrPrelude;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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};
|
||||
|
||||
|
|
|
@ -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<T:Send>(self, f: proc():Send -> T)
|
||||
-> Future<Result<T, Box<Any + Send>>> {
|
||||
|
@ -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!()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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),
|
||||
},
|
||||
}
|
||||
};
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -576,7 +576,7 @@ fn format(val: Param, op: FormatOp, flags: Flags) -> Result<Vec<u8> ,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() {
|
||||
|
|
|
@ -1262,7 +1262,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;
|
||||
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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 }
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 {
|
||||
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 => { }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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::<int,String>("kitty".to_string()).unwrap());
|
||||
println!("{}", Err::<int,String>("kitty".to_string()).unwrap());
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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> {
|
||||
|
|
|
@ -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<int>> = Ok(());
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ type rsrc_loader = proc(path: &Path):'static -> result::Result<String, String>;
|
|||
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");
|
||||
|
|
|
@ -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
|
||||
}}
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue