mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-05 11:48:30 +00:00
std: cleanup imports in result::tests
This commit is contained in:
parent
3478589b99
commit
b147d70b08
@ -15,7 +15,6 @@
|
|||||||
use clone::Clone;
|
use clone::Clone;
|
||||||
use cmp::Eq;
|
use cmp::Eq;
|
||||||
use either;
|
use either;
|
||||||
use either::Either;
|
|
||||||
use iterator::IteratorUtil;
|
use iterator::IteratorUtil;
|
||||||
use option::{None, Option, Some};
|
use option::{None, Option, Some};
|
||||||
use vec;
|
use vec;
|
||||||
@ -39,7 +38,7 @@ impl<T, E> Result<T, E> {
|
|||||||
* result variants are converted to `either::Left`.
|
* result variants are converted to `either::Left`.
|
||||||
*/
|
*/
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn to_either(self)-> Either<E, T>{
|
pub fn to_either(self)-> either::Either<E, T>{
|
||||||
match self {
|
match self {
|
||||||
Ok(t) => either::Right(t),
|
Ok(t) => either::Right(t),
|
||||||
Err(e) => either::Left(e),
|
Err(e) => either::Left(e),
|
||||||
@ -341,17 +340,16 @@ pub fn iter_vec2<S,T,U>(ss: &[S], ts: &[T],
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use result::{Err, Ok, Result};
|
use super::*;
|
||||||
use result;
|
|
||||||
use either;
|
use either;
|
||||||
|
|
||||||
pub fn op1() -> result::Result<int, ~str> { result::Ok(666) }
|
pub fn op1() -> Result<int, ~str> { Ok(666) }
|
||||||
|
|
||||||
pub fn op2(i: int) -> result::Result<uint, ~str> {
|
pub fn op2(i: int) -> Result<uint, ~str> {
|
||||||
result::Ok(i as uint + 1u)
|
Ok(i as uint + 1u)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn op3() -> result::Result<int, ~str> { result::Err(~"sadface") }
|
pub fn op3() -> Result<int, ~str> { Err(~"sadface") }
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
pub fn chain_success() {
|
pub fn chain_success() {
|
||||||
|
Loading…
Reference in New Issue
Block a user