Test fixes and rebase conflicts
This commit is contained in:
parent
158d99d3f1
commit
bde4c1d6fb
3 changed files with 6 additions and 10 deletions
|
@ -11,14 +11,12 @@
|
||||||
#![crate_name="static_methods_crate"]
|
#![crate_name="static_methods_crate"]
|
||||||
#![crate_type = "lib"]
|
#![crate_type = "lib"]
|
||||||
|
|
||||||
use std::int;
|
|
||||||
|
|
||||||
pub trait read {
|
pub trait read {
|
||||||
fn readMaybe(s: String) -> Option<Self>;
|
fn readMaybe(s: String) -> Option<Self>;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl read for int {
|
impl read for isize {
|
||||||
fn readMaybe(s: String) -> Option<int> {
|
fn readMaybe(s: String) -> Option<isize> {
|
||||||
s.parse().ok()
|
s.parse().ok()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,18 +9,18 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
use std::num::FromPrimitive;
|
use std::num::FromPrimitive;
|
||||||
use std::int;
|
use std::isize;
|
||||||
|
|
||||||
#[derive(PartialEq, FromPrimitive, Debug)]
|
#[derive(PartialEq, FromPrimitive, Debug)]
|
||||||
enum A {
|
enum A {
|
||||||
Foo = int::MAX,
|
Foo = isize::MAX,
|
||||||
Bar = 1,
|
Bar = 1,
|
||||||
Baz = 3,
|
Baz = 3,
|
||||||
Qux,
|
Qux,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
let x: Option<A> = FromPrimitive::from_int(int::MAX);
|
let x: Option<A> = FromPrimitive::from_int(isize::MAX);
|
||||||
assert_eq!(x, Some(A::Foo));
|
assert_eq!(x, Some(A::Foo));
|
||||||
|
|
||||||
let x: Option<A> = FromPrimitive::from_int(1);
|
let x: Option<A> = FromPrimitive::from_int(1);
|
||||||
|
|
|
@ -8,13 +8,11 @@
|
||||||
// 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::uint;
|
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
// sometimes we have had trouble finding
|
// sometimes we have had trouble finding
|
||||||
// the right type for f, as we unified
|
// the right type for f, as we unified
|
||||||
// bot and u32 here
|
// bot and u32 here
|
||||||
let f = match "1234".parse::<uint>().ok() {
|
let f = match "1234".parse::<usize>().ok() {
|
||||||
None => return (),
|
None => return (),
|
||||||
Some(num) => num as u32
|
Some(num) => num as u32
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue