Skip to content

Commit 6ef6c75

Browse files
committed
---
yaml --- r: 47510 b: refs/heads/try c: c3c018f h: refs/heads/master v: v3
1 parent 3fceb34 commit 6ef6c75

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 3bbcac322669cff3abde5be937cc4ec3860f3985
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: a6d9689399d091c3265f00434a69c551a61c28dc
5-
refs/heads/try: b269ce278228918b95f803e1951fa60e3ef48a0a
5+
refs/heads/try: c3c018f8ab017f915d629b2dfe5f4199d2d0145c
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/libcore/bool.rs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
//! Boolean logic
1313
1414
use option::{None, Option, Some};
15+
use from_str::FromStr;
16+
1517
#[cfg(notest)] use cmp;
1618

1719
/// Negation / inverse
@@ -46,13 +48,15 @@ pub pure fn is_true(v: bool) -> bool { v }
4648
pub pure fn is_false(v: bool) -> bool { !v }
4749

4850
/// Parse logic value from `s`
49-
pub pure fn from_str(s: &str) -> Option<bool> {
50-
if s == "true" {
51-
Some(true)
52-
} else if s == "false" {
53-
Some(false)
54-
} else {
55-
None
51+
impl FromStr for bool {
52+
static pure fn from_str(s: &str) -> Option<bool> {
53+
if s == "true" {
54+
Some(true)
55+
} else if s == "false" {
56+
Some(false)
57+
} else {
58+
None
59+
}
5660
}
5761
}
5862

@@ -79,8 +83,10 @@ impl cmp::Eq for bool {
7983

8084
#[test]
8185
pub fn test_bool_from_str() {
86+
use from_str::FromStr;
87+
8288
do all_values |v| {
83-
assert Some(v) == from_str(to_str(v))
89+
assert Some(v) == FromStr::from_str(to_str(v))
8490
}
8591
}
8692

branches/try/src/libcore/from_str.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,3 @@ use option::Option;
1515
pub trait FromStr {
1616
static pure fn from_str(s: &str) -> Option<Self>;
1717
}
18-

0 commit comments

Comments
 (0)