Skip to content

Commit 9f4e844

Browse files
committed
---
yaml --- r: 30743 b: refs/heads/incoming c: e85a3d8 h: refs/heads/master i: 30741: d019711 30739: 64431d1 30735: 26acc2e v: v3
1 parent be833bf commit 9f4e844

File tree

9 files changed

+60
-60
lines changed

9 files changed

+60
-60
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: d324a424d8f84b1eb049b12cf34182bda91b0024
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df
9-
refs/heads/incoming: 2d915678926f4b1c64c5916b01f526844f5521b9
9+
refs/heads/incoming: e85a3d82470e2e45db370b62e4fd54175c4b144d
1010
refs/heads/dist-snap: 2f32a1581f522e524009138b33b1c7049ced668d
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/incoming/src/libcore/f32.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,11 +158,11 @@ pure fn logarithm(n: f32, b: f32) -> f32 {
158158
}
159159

160160
impl f32: num::Num {
161-
pure fn add(&&other: f32) -> f32 { return self + other; }
162-
pure fn sub(&&other: f32) -> f32 { return self - other; }
163-
pure fn mul(&&other: f32) -> f32 { return self * other; }
164-
pure fn div(&&other: f32) -> f32 { return self / other; }
165-
pure fn modulo(&&other: f32) -> f32 { return self % other; }
161+
pure fn add(other: &f32) -> f32 { return self + *other; }
162+
pure fn sub(other: &f32) -> f32 { return self - *other; }
163+
pure fn mul(other: &f32) -> f32 { return self * *other; }
164+
pure fn div(other: &f32) -> f32 { return self / *other; }
165+
pure fn modulo(other: &f32) -> f32 { return self % *other; }
166166
pure fn neg() -> f32 { return -self; }
167167

168168
pure fn to_int() -> int { return self as int; }

branches/incoming/src/libcore/f64.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -185,11 +185,11 @@ pure fn logarithm(n: f64, b: f64) -> f64 {
185185
}
186186

187187
impl f64: num::Num {
188-
pure fn add(&&other: f64) -> f64 { return self + other; }
189-
pure fn sub(&&other: f64) -> f64 { return self - other; }
190-
pure fn mul(&&other: f64) -> f64 { return self * other; }
191-
pure fn div(&&other: f64) -> f64 { return self / other; }
192-
pure fn modulo(&&other: f64) -> f64 { return self % other; }
188+
pure fn add(other: &f64) -> f64 { return self + *other; }
189+
pure fn sub(other: &f64) -> f64 { return self - *other; }
190+
pure fn mul(other: &f64) -> f64 { return self * *other; }
191+
pure fn div(other: &f64) -> f64 { return self / *other; }
192+
pure fn modulo(other: &f64) -> f64 { return self % *other; }
193193
pure fn neg() -> f64 { return -self; }
194194

195195
pure fn to_int() -> int { return self as int; }

branches/incoming/src/libcore/float.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ fn to_str_common(num: float, digits: uint, exact: bool) -> ~str {
139139

140140
// while we still need digits
141141
// build stack of digits
142-
while ii > 0u && (frac >= epsilon_prime || exact) {
142+
while ii > 0 && (frac >= epsilon_prime || exact) {
143143
// store the next digit
144144
frac *= 10.0;
145145
let digit = frac as uint;
@@ -153,25 +153,25 @@ fn to_str_common(num: float, digits: uint, exact: bool) -> ~str {
153153

154154
let mut acc;
155155
let mut racc = ~"";
156-
let mut carry = if frac * 10.0 as uint >= 5u { 1u } else { 0u };
156+
let mut carry = if frac * 10.0 as uint >= 5 { 1 } else { 0 };
157157

158158
// turn digits into string
159159
// using stack of digits
160-
while vec::len(fractionalParts) > 0u {
160+
while fractionalParts.is_not_empty() {
161161
let mut adjusted_digit = carry + vec::pop(fractionalParts);
162162

163-
if adjusted_digit == 10u {
164-
carry = 1u;
165-
adjusted_digit %= 10u
163+
if adjusted_digit == 10 {
164+
carry = 1;
165+
adjusted_digit %= 10
166166
} else {
167-
carry = 0u
167+
carry = 0;
168168
};
169169

170170
racc = uint::str(adjusted_digit) + racc;
171171
}
172172

173173
// pad decimals with trailing zeroes
174-
while str::len(racc) < digits && exact {
174+
while racc.len() < digits && exact {
175175
racc += ~"0"
176176
}
177177

@@ -428,11 +428,11 @@ impl float : Ord {
428428
}
429429

430430
impl float: num::Num {
431-
pure fn add(&&other: float) -> float { return self + other; }
432-
pure fn sub(&&other: float) -> float { return self - other; }
433-
pure fn mul(&&other: float) -> float { return self * other; }
434-
pure fn div(&&other: float) -> float { return self / other; }
435-
pure fn modulo(&&other: float) -> float { return self % other; }
431+
pure fn add(other: &float) -> float { return self + *other; }
432+
pure fn sub(other: &float) -> float { return self - *other; }
433+
pure fn mul(other: &float) -> float { return self * *other; }
434+
pure fn div(other: &float) -> float { return self / *other; }
435+
pure fn modulo(other: &float) -> float { return self % *other; }
436436
pure fn neg() -> float { return -self; }
437437

438438
pure fn to_int() -> int { return self as int; }
@@ -540,11 +540,11 @@ fn test_traits() {
540540
let two: U = from_int(2);
541541
assert (two.to_int() == 2);
542542

543-
assert (ten.add(two) == from_int(12));
544-
assert (ten.sub(two) == from_int(8));
545-
assert (ten.mul(two) == from_int(20));
546-
assert (ten.div(two) == from_int(5));
547-
assert (ten.modulo(two) == from_int(0));
543+
assert (ten.add(&two) == from_int(12));
544+
assert (ten.sub(&two) == from_int(8));
545+
assert (ten.mul(&two) == from_int(20));
546+
assert (ten.div(&two) == from_int(5));
547+
assert (ten.modulo(&two) == from_int(0));
548548
}
549549

550550
test(&10.0);

branches/incoming/src/libcore/int-template.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,11 @@ impl T : Eq {
8181
}
8282

8383
impl T: num::Num {
84-
pure fn add(&&other: T) -> T { return self + other; }
85-
pure fn sub(&&other: T) -> T { return self - other; }
86-
pure fn mul(&&other: T) -> T { return self * other; }
87-
pure fn div(&&other: T) -> T { return self / other; }
88-
pure fn modulo(&&other: T) -> T { return self % other; }
84+
pure fn add(other: &T) -> T { return self + *other; }
85+
pure fn sub(other: &T) -> T { return self - *other; }
86+
pure fn mul(other: &T) -> T { return self * *other; }
87+
pure fn div(other: &T) -> T { return self / *other; }
88+
pure fn modulo(other: &T) -> T { return self % *other; }
8989
pure fn neg() -> T { return -self; }
9090

9191
pure fn to_int() -> int { return self as int; }
@@ -250,11 +250,11 @@ fn test_interfaces() {
250250
let two: U = from_int(2);
251251
assert (two.to_int() == 2);
252252

253-
assert (ten.add(two) == from_int(12));
254-
assert (ten.sub(two) == from_int(8));
255-
assert (ten.mul(two) == from_int(20));
256-
assert (ten.div(two) == from_int(5));
257-
assert (ten.modulo(two) == from_int(0));
253+
assert (ten.add(&two) == from_int(12));
254+
assert (ten.sub(&two) == from_int(8));
255+
assert (ten.mul(&two) == from_int(20));
256+
assert (ten.div(&two) == from_int(5));
257+
assert (ten.modulo(&two) == from_int(0));
258258
assert (ten.neg() == from_int(-10));
259259
}
260260

branches/incoming/src/libcore/num.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
33
trait Num {
44
// FIXME: Trait composition. (#2616)
5-
pure fn add(&&other: self) -> self;
6-
pure fn sub(&&other: self) -> self;
7-
pure fn mul(&&other: self) -> self;
8-
pure fn div(&&other: self) -> self;
9-
pure fn modulo(&&other: self) -> self;
5+
pure fn add(other: &self) -> self;
6+
pure fn sub(other: &self) -> self;
7+
pure fn mul(other: &self) -> self;
8+
pure fn div(other: &self) -> self;
9+
pure fn modulo(other: &self) -> self;
1010
pure fn neg() -> self;
1111

1212
pure fn to_int() -> int;

branches/incoming/src/libcore/str.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ pure fn byte_slice<T>(s: &str, f: fn(v: &[u8]) -> T) -> T {
464464

465465
/// Convert a string to a vector of characters
466466
pure fn chars(s: &str) -> ~[char] {
467-
let mut buf = ~[], i = 0u;
467+
let mut buf = ~[], i = 0;
468468
let len = len(s);
469469
while i < len {
470470
let {ch, next} = char_range_at(s, i);

branches/incoming/src/libcore/uint-template.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,11 @@ impl T : Eq {
7474
}
7575

7676
impl T: num::Num {
77-
pure fn add(&&other: T) -> T { return self + other; }
78-
pure fn sub(&&other: T) -> T { return self - other; }
79-
pure fn mul(&&other: T) -> T { return self * other; }
80-
pure fn div(&&other: T) -> T { return self / other; }
81-
pure fn modulo(&&other: T) -> T { return self % other; }
77+
pure fn add(other: &T) -> T { return self + *other; }
78+
pure fn sub(other: &T) -> T { return self - *other; }
79+
pure fn mul(other: &T) -> T { return self * *other; }
80+
pure fn div(other: &T) -> T { return self / *other; }
81+
pure fn modulo(other: &T) -> T { return self % *other; }
8282
pure fn neg() -> T { return -self; }
8383

8484
pure fn to_int() -> int { return self as int; }

branches/incoming/src/test/run-pass/numeric-method-autoexport.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
fn main() {
66
// ints
77
// num
8-
assert 15.add(6) == 21;
9-
assert 15i8.add(6i8) == 21i8;
10-
assert 15i16.add(6i16) == 21i16;
11-
assert 15i32.add(6i32) == 21i32;
12-
assert 15i64.add(6i64) == 21i64;
8+
assert 15.add(&6) == 21;
9+
assert 15i8.add(&6i8) == 21i8;
10+
assert 15i16.add(&6i16) == 21i16;
11+
assert 15i32.add(&6i32) == 21i32;
12+
assert 15i64.add(&6i64) == 21i64;
1313
// times
1414
15.times(|| false);
1515
15i8.times(|| false);
@@ -19,11 +19,11 @@ fn main() {
1919

2020
// uints
2121
// num
22-
assert 15u.add(6u) == 21u;
23-
assert 15u8.add(6u8) == 21u8;
24-
assert 15u16.add(6u16) == 21u16;
25-
assert 15u32.add(6u32) == 21u32;
26-
assert 15u64.add(6u64) == 21u64;
22+
assert 15u.add(&6u) == 21u;
23+
assert 15u8.add(&6u8) == 21u8;
24+
assert 15u16.add(&6u16) == 21u16;
25+
assert 15u32.add(&6u32) == 21u32;
26+
assert 15u64.add(&6u64) == 21u64;
2727
// times
2828
15u.times(|| false);
2929
15u8.times(|| false);

0 commit comments

Comments
 (0)