Skip to content

Commit ab1cb78

Browse files
committed
---
yaml --- r: 46827 b: refs/heads/auto c: 194c27b h: refs/heads/master i: 46825: 43440fa 46823: cd333ba v: v3
1 parent b450d40 commit ab1cb78

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
@@ -14,4 +14,4 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1414
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1515
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1616
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
17-
refs/heads/auto: a69ec175f8ebddf210f846abdbb7e8a441790f0a
17+
refs/heads/auto: 194c27bcd16ad92e2edf11ff7446cb679a91c1d3

branches/auto/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/auto/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)