mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-23 21:23:56 +00:00
Rustup to 1.9.0-nightly (30a3849f2 2016-03-30)
This commit is contained in:
parent
4f17633653
commit
9438f4f263
13 changed files with 44 additions and 40 deletions
|
@ -1,9 +1,10 @@
|
|||
use rustc::lint::*;
|
||||
use rustc::middle::const_eval::EvalHint::ExprTypeChecked;
|
||||
use rustc::middle::const_eval::{eval_const_expr_partial, ConstVal};
|
||||
use rustc::middle::const_val::ConstVal;
|
||||
use rustc::ty::TyArray;
|
||||
use rustc_const_eval::EvalHint::ExprTypeChecked;
|
||||
use rustc_const_eval::eval_const_expr_partial;
|
||||
use rustc_const_math::ConstInt;
|
||||
use rustc_front::hir::*;
|
||||
use rustc_const_eval::ConstInt;
|
||||
use syntax::ast::RangeLimits;
|
||||
use utils;
|
||||
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
use rustc::lint::*;
|
||||
use rustc::middle::const_eval::lookup_const_by_id;
|
||||
use rustc::middle::def::{Def, PathResolution};
|
||||
use rustc_const_eval::lookup_const_by_id;
|
||||
use rustc_front::hir::*;
|
||||
use rustc_front::util::is_comparison_binop;
|
||||
use syntax::ast::LitKind;
|
||||
use syntax::codemap::Span;
|
||||
|
||||
use utils::span_lint;
|
||||
|
||||
/// **What it does:** This lint checks for incompatible bit masks in comparisons.
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#![allow(cast_possible_truncation)]
|
||||
|
||||
use rustc::lint::LateContext;
|
||||
use rustc::middle::const_eval::lookup_const_by_id;
|
||||
use rustc::middle::def::{Def, PathResolution};
|
||||
use rustc_const_eval::lookup_const_by_id;
|
||||
use rustc_const_math::{ConstInt, ConstUsize, ConstIsize};
|
||||
use rustc_front::hir::*;
|
||||
use rustc_const_eval::{ConstInt, ConstUsize, ConstIsize};
|
||||
use std::cmp::Ordering::{self, Equal};
|
||||
use std::cmp::PartialOrd;
|
||||
use std::hash::{Hash, Hasher};
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
//! lint on C-like enums that are `repr(isize/usize)` and have values that don't fit into an `i32`
|
||||
|
||||
use rustc::lint::*;
|
||||
use syntax::attr::*;
|
||||
use rustc::middle::const_val::ConstVal;
|
||||
use rustc_const_math::*;
|
||||
use rustc_front::hir::*;
|
||||
use rustc::middle::const_eval::{ConstVal, EvalHint, eval_const_expr_partial};
|
||||
use syntax::attr::*;
|
||||
use utils::span_lint;
|
||||
|
||||
/// **What it does:** Lints on C-like enums that are `repr(isize/usize)` and have values that don't fit into an `i32`.
|
||||
|
|
|
@ -3,7 +3,7 @@ use rustc::lint::*;
|
|||
use rustc_front::hir::*;
|
||||
use syntax::codemap::Span;
|
||||
use utils::{span_lint, snippet, in_macro};
|
||||
use rustc_const_eval::ConstInt;
|
||||
use rustc_const_math::ConstInt;
|
||||
|
||||
/// **What it does:** This lint checks for identity operations, e.g. `x + 0`.
|
||||
///
|
||||
|
|
|
@ -42,6 +42,7 @@ extern crate quine_mc_cluskey;
|
|||
|
||||
extern crate rustc_plugin;
|
||||
extern crate rustc_const_eval;
|
||||
extern crate rustc_const_math;
|
||||
use rustc_plugin::Registry;
|
||||
|
||||
pub mod consts;
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
use reexport::*;
|
||||
use rustc::front::map::Node::NodeBlock;
|
||||
use rustc::lint::*;
|
||||
use rustc::middle::const_eval::EvalHint::ExprTypeChecked;
|
||||
use rustc::middle::const_eval::{ConstVal, eval_const_expr_partial};
|
||||
use rustc::middle::const_val::ConstVal;
|
||||
use rustc::middle::def::Def;
|
||||
use rustc::middle::region::CodeExtent;
|
||||
use rustc::ty;
|
||||
use rustc_const_eval::EvalHint::ExprTypeChecked;
|
||||
use rustc_const_eval::eval_const_expr_partial;
|
||||
use rustc_front::hir::*;
|
||||
use rustc_front::intravisit::{Visitor, walk_expr, walk_block, walk_decl};
|
||||
use std::borrow::Cow;
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
use rustc::lint::*;
|
||||
use rustc::middle::const_eval::EvalHint::ExprTypeChecked;
|
||||
use rustc::middle::const_eval::{eval_const_expr_partial, ConstVal};
|
||||
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::ConstInt;
|
||||
use rustc_front::hir::*;
|
||||
use rustc_const_eval::ConstInt;
|
||||
use std::cmp::Ordering;
|
||||
use syntax::ast::LitKind;
|
||||
use syntax::codemap::Span;
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
use rustc::lint::*;
|
||||
use rustc::middle::const_eval::EvalHint::ExprTypeChecked;
|
||||
use rustc::middle::const_eval::{ConstVal, eval_const_expr_partial};
|
||||
use rustc::middle::const_val::ConstVal;
|
||||
use rustc::middle::cstore::CrateStore;
|
||||
use rustc::ty::subst::{Subst, TypeSpace};
|
||||
use rustc::ty;
|
||||
use rustc_const_eval::EvalHint::ExprTypeChecked;
|
||||
use rustc_const_eval::eval_const_expr_partial;
|
||||
use rustc_front::hir::*;
|
||||
use std::borrow::Cow;
|
||||
use std::fmt;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
use reexport::*;
|
||||
use rustc::lint::*;
|
||||
use rustc::middle::const_eval::ConstVal::Float;
|
||||
use rustc::middle::const_eval::EvalHint::ExprTypeChecked;
|
||||
use rustc::middle::const_eval::eval_const_expr_partial;
|
||||
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_front::hir::*;
|
||||
use rustc_front::intravisit::FnKind;
|
||||
use rustc_front::util::{is_comparison_binop, binop_to_string};
|
||||
|
@ -180,7 +180,7 @@ 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(Float(val)) = res {
|
||||
if let Ok(ConstVal::Float(val)) = res {
|
||||
val == 0.0 || val == ::std::f64::INFINITY || val == ::std::f64::NEG_INFINITY
|
||||
} else {
|
||||
false
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
use regex_syntax;
|
||||
use rustc::lint::*;
|
||||
use rustc::middle::const_eval::EvalHint::ExprTypeChecked;
|
||||
use rustc::middle::const_eval::{eval_const_expr_partial, ConstVal};
|
||||
use rustc::middle::const_val::ConstVal;
|
||||
use rustc_const_eval::EvalHint::ExprTypeChecked;
|
||||
use rustc_const_eval::eval_const_expr_partial;
|
||||
use rustc_front::hir::*;
|
||||
use std::collections::HashSet;
|
||||
use std::error::Error;
|
||||
|
|
11
src/types.rs
11
src/types.rs
|
@ -1,6 +1,6 @@
|
|||
use reexport::*;
|
||||
use rustc::lint::*;
|
||||
use rustc::middle::{const_eval, def};
|
||||
use rustc::middle::def;
|
||||
use rustc::ty;
|
||||
use rustc_front::hir::*;
|
||||
use rustc_front::intravisit::{FnKind, Visitor, walk_ty};
|
||||
|
@ -683,10 +683,11 @@ fn detect_absurd_comparison<'a>(cx: &LateContext, op: BinOp_, lhs: &'a Expr, rhs
|
|||
}
|
||||
|
||||
fn detect_extreme_expr<'a>(cx: &LateContext, expr: &'a Expr) -> Option<ExtremeExpr<'a>> {
|
||||
use rustc::middle::const_eval::EvalHint::ExprTypeChecked;
|
||||
use types::ExtremeType::*;
|
||||
use rustc::middle::const_eval::ConstVal::*;
|
||||
use rustc::middle::const_val::ConstVal::*;
|
||||
use rustc_const_math::*;
|
||||
use rustc_const_eval::EvalHint::ExprTypeChecked;
|
||||
use rustc_const_eval::*;
|
||||
use types::ExtremeType::*;
|
||||
|
||||
let ty = &cx.tcx.expr_ty(expr).sty;
|
||||
|
||||
|
@ -695,7 +696,7 @@ fn detect_extreme_expr<'a>(cx: &LateContext, expr: &'a Expr) -> Option<ExtremeEx
|
|||
_ => return None,
|
||||
};
|
||||
|
||||
let cv = match const_eval::eval_const_expr_partial(cx.tcx, expr, ExprTypeChecked, None) {
|
||||
let cv = match eval_const_expr_partial(cx.tcx, expr, ExprTypeChecked, None) {
|
||||
Ok(val) => val,
|
||||
Err(_) => return None,
|
||||
};
|
||||
|
|
|
@ -2,22 +2,19 @@
|
|||
#![feature(rustc_private)]
|
||||
|
||||
extern crate clippy;
|
||||
extern crate syntax;
|
||||
extern crate rustc;
|
||||
extern crate rustc_front;
|
||||
extern crate rustc_const_eval;
|
||||
|
||||
use rustc_front::hir::*;
|
||||
use rustc_const_eval::ConstInt;
|
||||
use syntax::parse::token::InternedString;
|
||||
use syntax::ptr::P;
|
||||
use syntax::codemap::{Spanned, COMMAND_LINE_SP};
|
||||
|
||||
use syntax::ast::LitKind;
|
||||
use syntax::ast::LitIntType;
|
||||
use syntax::ast::StrStyle;
|
||||
extern crate rustc_const_math;
|
||||
extern crate rustc_front;
|
||||
extern crate syntax;
|
||||
|
||||
use clippy::consts::{constant_simple, Constant, FloatWidth};
|
||||
use rustc_const_math::ConstInt;
|
||||
use rustc_front::hir::*;
|
||||
use syntax::ast::{LitIntType, LitKind, StrStyle};
|
||||
use syntax::codemap::{Spanned, COMMAND_LINE_SP};
|
||||
use syntax::parse::token::InternedString;
|
||||
use syntax::ptr::P;
|
||||
|
||||
fn spanned<T>(t: T) -> Spanned<T> {
|
||||
Spanned{ node: t, span: COMMAND_LINE_SP }
|
||||
|
|
Loading…
Reference in a new issue