Skip to content

Commit e20992d

Browse files
committed
---
yaml --- r: 23624 b: refs/heads/master c: 2580040 h: refs/heads/master v: v3
1 parent e01d2f4 commit e20992d

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 340a21929024efedec5dfa8d4c6a14df41640f78
2+
refs/heads/master: 2580040995ec0db96aa180170195c1ae318fc9ed
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
55
refs/heads/try: ffbe0e0e00374358b789b0037bcb3a577cd218be

trunk/src/libstd/cmp.rs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,36 @@
11
#[deny(non_camel_case_types)];
2+
#[forbid(deprecated_mode)];
3+
#[forbid(deprecated_pattern)];
24
/// Additional general-purpose comparison functionality.
35
46
const fuzzy_epsilon: float = 1.0e-6;
57

68
trait FuzzyEq {
7-
pure fn fuzzy_eq(&&other: self) -> bool;
9+
pure fn fuzzy_eq(other: &self) -> bool;
810
}
911

1012
impl float: FuzzyEq {
11-
pure fn fuzzy_eq(&&other: float) -> bool {
12-
return float::abs(self - other) < fuzzy_epsilon;
13+
pure fn fuzzy_eq(other: &float) -> bool {
14+
return float::abs(self - *other) < fuzzy_epsilon;
1315
}
1416
}
1517

1618
impl f32: FuzzyEq {
17-
pure fn fuzzy_eq(&&other: f32) -> bool {
18-
return f32::abs(self - other) < (fuzzy_epsilon as f32);
19+
pure fn fuzzy_eq(other: &f32) -> bool {
20+
return f32::abs(self - *other) < (fuzzy_epsilon as f32);
1921
}
2022
}
2123

2224
impl f64: FuzzyEq {
23-
pure fn fuzzy_eq(&&other: f64) -> bool {
24-
return f64::abs(self - other) < (fuzzy_epsilon as f64);
25+
pure fn fuzzy_eq(other: &f64) -> bool {
26+
return f64::abs(self - *other) < (fuzzy_epsilon as f64);
2527
}
2628
}
2729

2830
#[test]
2931
fn test_fuzzy_equals() {
30-
assert ((1.0).fuzzy_eq(1.0));
31-
assert ((1.0f32).fuzzy_eq(1.0f32));
32-
assert ((1.0f64).fuzzy_eq(1.0f64));
32+
assert ((&1.0).fuzzy_eq(&1.0));
33+
assert ((&1.0f32).fuzzy_eq(&1.0f32));
34+
assert ((&1.0f64).fuzzy_eq(&1.0f64));
3335
}
3436

0 commit comments

Comments
 (0)