Skip to content

Rustup to *rustc 1.11.0-nightly (763f9234b 2016-06-06)* #993

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 8, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Change Log
All notable changes to this project will be documented in this file.

## 0.0.75 — 2016-06-08
* Rustup to *rustc 1.11.0-nightly (763f9234b 2016-06-06)*

## 0.0.74 — 2016-06-07
* Fix bug with `cargo-clippy` JSON parsing
* Add the `CLIPPY_DISABLE_WIKI_LINKS` environment variable to deactivate the
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "clippy"
version = "0.0.74"
version = "0.0.75"
authors = [
"Manish Goregaokar <[email protected]>",
"Andre Bogus <[email protected]>",
Expand Down Expand Up @@ -30,7 +30,7 @@ toml = "0.1"
unicode-normalization = "0.1"
quine-mc_cluskey = "0.2.2"
# begin automatic update
clippy_lints = { version = "0.0.74", path = "clippy_lints" }
clippy_lints = { version = "0.0.75", path = "clippy_lints" }
# end automatic update
rustc-serialize = "0.3"

Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "clippy_lints"
# begin automatic update
version = "0.0.74"
version = "0.0.75"
# end automatic update
authors = [
"Manish Goregaokar <[email protected]>",
Expand Down
22 changes: 21 additions & 1 deletion clippy_lints/src/misc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use rustc::middle::const_val::ConstVal;
use rustc::ty;
use rustc_const_eval::EvalHint::ExprTypeChecked;
use rustc_const_eval::eval_const_expr_partial;
use rustc_const_math::ConstFloat;
use syntax::codemap::{Span, Spanned, ExpnFormat};
use syntax::ptr::P;
use utils::{
Expand Down Expand Up @@ -182,7 +183,26 @@ impl LateLintPass for FloatCmp {
fn is_allowed(cx: &LateContext, expr: &Expr) -> bool {
let res = eval_const_expr_partial(cx.tcx, expr, ExprTypeChecked, None);
if let Ok(ConstVal::Float(val)) = res {
val == 0.0 || val == ::std::f64::INFINITY || val == ::std::f64::NEG_INFINITY
use std::cmp::Ordering;

let zero = ConstFloat::FInfer {
f32: 0.0,
f64: 0.0,
};

let infinity = ConstFloat::FInfer {
f32: ::std::f32::INFINITY,
f64: ::std::f64::INFINITY,
};

let neg_infinity = ConstFloat::FInfer {
f32: ::std::f32::NEG_INFINITY,
f64: ::std::f64::NEG_INFINITY,
};

val.try_cmp(zero) == Ok(Ordering::Equal)
|| val.try_cmp(infinity) == Ok(Ordering::Equal)
|| val.try_cmp(neg_infinity) == Ok(Ordering::Equal)
} else {
false
}
Expand Down