Skip to content

Commit 2577e3e

Browse files
committed
Tidy up predicate names in libcore. Should close #1431.
1 parent 4baf2ce commit 2577e3e

File tree

8 files changed

+35
-35
lines changed

8 files changed

+35
-35
lines changed

src/libcore/i16.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ pure fn ne(x: i16, y: i16) -> bool { x != y }
1919
pure fn ge(x: i16, y: i16) -> bool { x >= y }
2020
pure fn gt(x: i16, y: i16) -> bool { x > y }
2121

22-
pure fn positive(x: i16) -> bool { x > 0i16 }
23-
pure fn negative(x: i16) -> bool { x < 0i16 }
24-
pure fn nonpositive(x: i16) -> bool { x <= 0i16 }
25-
pure fn nonnegative(x: i16) -> bool { x >= 0i16 }
22+
pure fn is_positive(x: i16) -> bool { x > 0i16 }
23+
pure fn is_negative(x: i16) -> bool { x < 0i16 }
24+
pure fn is_nonpositive(x: i16) -> bool { x <= 0i16 }
25+
pure fn is_nonnegative(x: i16) -> bool { x >= 0i16 }
2626

2727
#[doc = "Iterate over the range [`lo`..`hi`)"]
2828
fn range(lo: i16, hi: i16, it: fn(i16)) {
@@ -37,5 +37,5 @@ pure fn compl(i: i16) -> i16 {
3737

3838
#[doc = "Computes the absolute value"]
3939
pure fn abs(i: i16) -> i16 {
40-
if negative(i) { -i } else { i }
40+
if is_negative(i) { -i } else { i }
4141
}

src/libcore/i32.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ pure fn ne(x: i32, y: i32) -> bool { x != y }
1919
pure fn ge(x: i32, y: i32) -> bool { x >= y }
2020
pure fn gt(x: i32, y: i32) -> bool { x > y }
2121

22-
pure fn positive(x: i32) -> bool { x > 0i32 }
23-
pure fn negative(x: i32) -> bool { x < 0i32 }
24-
pure fn nonpositive(x: i32) -> bool { x <= 0i32 }
25-
pure fn nonnegative(x: i32) -> bool { x >= 0i32 }
22+
pure fn is_positive(x: i32) -> bool { x > 0i32 }
23+
pure fn is_negative(x: i32) -> bool { x < 0i32 }
24+
pure fn is_nonpositive(x: i32) -> bool { x <= 0i32 }
25+
pure fn is_nonnegative(x: i32) -> bool { x >= 0i32 }
2626

2727
#[doc = "Iterate over the range [`lo`..`hi`)"]
2828
fn range(lo: i32, hi: i32, it: fn(i32)) {
@@ -37,5 +37,5 @@ pure fn compl(i: i32) -> i32 {
3737

3838
#[doc = "Computes the absolute value"]
3939
pure fn abs(i: i32) -> i32 {
40-
if negative(i) { -i } else { i }
40+
if is_negative(i) { -i } else { i }
4141
}

src/libcore/i64.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ pure fn ne(x: i64, y: i64) -> bool { x != y }
1919
pure fn ge(x: i64, y: i64) -> bool { x >= y }
2020
pure fn gt(x: i64, y: i64) -> bool { x > y }
2121

22-
pure fn positive(x: i64) -> bool { x > 0i64 }
23-
pure fn negative(x: i64) -> bool { x < 0i64 }
24-
pure fn nonpositive(x: i64) -> bool { x <= 0i64 }
25-
pure fn nonnegative(x: i64) -> bool { x >= 0i64 }
22+
pure fn is_positive(x: i64) -> bool { x > 0i64 }
23+
pure fn is_negative(x: i64) -> bool { x < 0i64 }
24+
pure fn is_nonpositive(x: i64) -> bool { x <= 0i64 }
25+
pure fn is_nonnegative(x: i64) -> bool { x >= 0i64 }
2626

2727
#[doc = "Iterate over the range [`lo`..`hi`)"]
2828
fn range(lo: i64, hi: i64, it: fn(i64)) {
@@ -37,5 +37,5 @@ pure fn compl(i: i64) -> i64 {
3737

3838
#[doc = "Computes the absolute value"]
3939
pure fn abs(i: i64) -> i64 {
40-
if negative(i) { -i } else { i }
40+
if is_negative(i) { -i } else { i }
4141
}

src/libcore/i8.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ pure fn ne(x: i8, y: i8) -> bool { x != y }
1919
pure fn ge(x: i8, y: i8) -> bool { x >= y }
2020
pure fn gt(x: i8, y: i8) -> bool { x > y }
2121

22-
pure fn positive(x: i8) -> bool { x > 0i8 }
23-
pure fn negative(x: i8) -> bool { x < 0i8 }
24-
pure fn nonpositive(x: i8) -> bool { x <= 0i8 }
25-
pure fn nonnegative(x: i8) -> bool { x >= 0i8 }
22+
pure fn is_positive(x: i8) -> bool { x > 0i8 }
23+
pure fn is_negative(x: i8) -> bool { x < 0i8 }
24+
pure fn is_nonpositive(x: i8) -> bool { x <= 0i8 }
25+
pure fn is_nonnegative(x: i8) -> bool { x >= 0i8 }
2626

2727
#[doc = "Iterate over the range [`lo`..`hi`)"]
2828
fn range(lo: i8, hi: i8, it: fn(i8)) {
@@ -37,5 +37,5 @@ pure fn compl(i: i8) -> i8 {
3737

3838
#[doc = "Computes the absolute value"]
3939
pure fn abs(i: i8) -> i8 {
40-
if negative(i) { -i } else { i }
40+
if is_negative(i) { -i } else { i }
4141
}

src/libcore/int.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ pure fn ne(x: int, y: int) -> bool { ret x != y; }
3030
pure fn ge(x: int, y: int) -> bool { ret x >= y; }
3131
pure fn gt(x: int, y: int) -> bool { ret x > y; }
3232

33-
pure fn positive(x: int) -> bool { ret x > 0; }
34-
pure fn negative(x: int) -> bool { ret x < 0; }
35-
pure fn nonpositive(x: int) -> bool { ret x <= 0; }
36-
pure fn nonnegative(x: int) -> bool { ret x >= 0; }
33+
pure fn is_positive(x: int) -> bool { ret x > 0; }
34+
pure fn is_negative(x: int) -> bool { ret x < 0; }
35+
pure fn is_nonpositive(x: int) -> bool { ret x <= 0; }
36+
pure fn is_nonnegative(x: int) -> bool { ret x >= 0; }
3737

3838
#[doc = "Produce a uint suitable for use in a hash table"]
3939
pure fn hash(x: int) -> uint { ret x as uint; }
@@ -112,7 +112,7 @@ pure fn compl(i: int) -> int {
112112

113113
#[doc = "Computes the absolute value"]
114114
fn abs(i: int) -> int {
115-
if negative(i) { -i } else { i }
115+
if is_negative(i) { -i } else { i }
116116
}
117117

118118
#[test]

src/libcore/result.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,16 @@ pure fn get_err<T, U: copy>(res: result<T, U>) -> U {
4444
}
4545

4646
#[doc = "Returns true if the result is `ok`"]
47-
pure fn success<T, U>(res: result<T, U>) -> bool {
47+
pure fn is_success<T, U>(res: result<T, U>) -> bool {
4848
alt res {
4949
ok(_) { true }
5050
err(_) { false }
5151
}
5252
}
5353

5454
#[doc = "Returns true if the result is `error`"]
55-
pure fn failure<T, U>(res: result<T, U>) -> bool {
56-
!success(res)
55+
pure fn is_failure<T, U>(res: result<T, U>) -> bool {
56+
!is_success(res)
5757
}
5858

5959
#[doc = "
@@ -113,9 +113,9 @@ impl extensions<T:copy, E:copy> for result<T,E> {
113113

114114
fn get_err() -> E { get_err(self) }
115115

116-
fn success() -> bool { success(self) }
116+
fn is_success() -> bool { is_success(self) }
117117

118-
fn failure() -> bool { failure(self) }
118+
fn is_failure() -> bool { is_failure(self) }
119119

120120
fn chain<U:copy>(op: fn(T) -> result<U,E>) -> result<U,E> {
121121
chain(self, op)

src/libcore/u16.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ pure fn ne(x: u16, y: u16) -> bool { x != y }
1919
pure fn ge(x: u16, y: u16) -> bool { x >= y }
2020
pure fn gt(x: u16, y: u16) -> bool { x > y }
2121

22-
pure fn positive(x: u16) -> bool { x > 0u16 }
23-
pure fn negative(x: u16) -> bool { x < 0u16 }
24-
pure fn nonpositive(x: u16) -> bool { x <= 0u16 }
25-
pure fn nonnegative(x: u16) -> bool { x >= 0u16 }
22+
pure fn is_positive(x: u16) -> bool { x > 0u16 }
23+
pure fn is_negative(x: u16) -> bool { x < 0u16 }
24+
pure fn is_nonpositive(x: u16) -> bool { x <= 0u16 }
25+
pure fn is_nonnegative(x: u16) -> bool { x >= 0u16 }
2626

2727
#[doc = "Iterate over the range [`lo`..`hi`)"]
2828
fn range(lo: u16, hi: u16, it: fn(u16)) {

src/test/run-pass/cleanup-copy-mode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
fn adder(+x: @int, +y: @int) -> int { ret *x + *y; }
33
fn failer() -> @int { fail; }
44
fn main() {
5-
assert(result::failure(task::try {||
5+
assert(result::is_failure(task::try {||
66
adder(@2, failer()); ()
77
}));
88
}

0 commit comments

Comments
 (0)