Skip to content

Commit 94cc344

Browse files
committed
Merge pull request #993 from Manishearth/rustup
Rustup to *rustc 1.11.0-nightly (763f923 2016-06-06)*
2 parents f4726c0 + 11ea3b8 commit 94cc344

File tree

4 files changed

+27
-4
lines changed

4 files changed

+27
-4
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Change Log
22
All notable changes to this project will be documented in this file.
33

4+
## 0.0.75 — 2016-06-08
5+
* Rustup to *rustc 1.11.0-nightly (763f9234b 2016-06-06)*
6+
47
## 0.0.74 — 2016-06-07
58
* Fix bug with `cargo-clippy` JSON parsing
69
* Add the `CLIPPY_DISABLE_WIKI_LINKS` environment variable to deactivate the

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "clippy"
3-
version = "0.0.74"
3+
version = "0.0.75"
44
authors = [
55
"Manish Goregaokar <[email protected]>",
66
"Andre Bogus <[email protected]>",
@@ -30,7 +30,7 @@ toml = "0.1"
3030
unicode-normalization = "0.1"
3131
quine-mc_cluskey = "0.2.2"
3232
# begin automatic update
33-
clippy_lints = { version = "0.0.74", path = "clippy_lints" }
33+
clippy_lints = { version = "0.0.75", path = "clippy_lints" }
3434
# end automatic update
3535
rustc-serialize = "0.3"
3636

clippy_lints/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "clippy_lints"
33
# begin automatic update
4-
version = "0.0.74"
4+
version = "0.0.75"
55
# end automatic update
66
authors = [
77
"Manish Goregaokar <[email protected]>",

clippy_lints/src/misc.rs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use rustc::middle::const_val::ConstVal;
66
use rustc::ty;
77
use rustc_const_eval::EvalHint::ExprTypeChecked;
88
use rustc_const_eval::eval_const_expr_partial;
9+
use rustc_const_math::ConstFloat;
910
use syntax::codemap::{Span, Spanned, ExpnFormat};
1011
use syntax::ptr::P;
1112
use utils::{
@@ -182,7 +183,26 @@ impl LateLintPass for FloatCmp {
182183
fn is_allowed(cx: &LateContext, expr: &Expr) -> bool {
183184
let res = eval_const_expr_partial(cx.tcx, expr, ExprTypeChecked, None);
184185
if let Ok(ConstVal::Float(val)) = res {
185-
val == 0.0 || val == ::std::f64::INFINITY || val == ::std::f64::NEG_INFINITY
186+
use std::cmp::Ordering;
187+
188+
let zero = ConstFloat::FInfer {
189+
f32: 0.0,
190+
f64: 0.0,
191+
};
192+
193+
let infinity = ConstFloat::FInfer {
194+
f32: ::std::f32::INFINITY,
195+
f64: ::std::f64::INFINITY,
196+
};
197+
198+
let neg_infinity = ConstFloat::FInfer {
199+
f32: ::std::f32::NEG_INFINITY,
200+
f64: ::std::f64::NEG_INFINITY,
201+
};
202+
203+
val.try_cmp(zero) == Ok(Ordering::Equal)
204+
|| val.try_cmp(infinity) == Ok(Ordering::Equal)
205+
|| val.try_cmp(neg_infinity) == Ok(Ordering::Equal)
186206
} else {
187207
false
188208
}

0 commit comments

Comments
 (0)