Skip to content
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

[WIP] Rustup to 1.9.0-nightly (bf5da36f1 2016-04-06) #842

Closed
wants to merge 2 commits into from
Closed
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
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "clippy"
version = "0.0.61"
version = "0.0.62"
authors = [
"Manish Goregaokar <[email protected]>",
"Andre Bogus <[email protected]>",
Expand Down
2 changes: 1 addition & 1 deletion src/approx_const.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use rustc::lint::*;
use rustc_front::hir::*;
use rustc::hir::*;
use std::f64::consts as f64;
use syntax::ast::{Lit, LitKind, FloatTy};
use utils::span_lint;
Expand Down
2 changes: 1 addition & 1 deletion src/array_indexing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ 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::hir::*;
use syntax::ast::RangeLimits;
use utils;

Expand Down
2 changes: 1 addition & 1 deletion src/attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
use reexport::*;
use rustc::lint::*;
use rustc_front::hir::*;
use rustc::hir::*;
use semver::Version;
use syntax::ast::{Attribute, Lit, LitKind, MetaItemKind};
use syntax::attr::*;
Expand Down
7 changes: 3 additions & 4 deletions src/bit_mask.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use rustc::hir::*;
use rustc::hir::def::{Def, PathResolution};
use rustc::lint::*;
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;
Expand Down Expand Up @@ -91,7 +90,7 @@ impl LintPass for BitMask {
impl LateLintPass for BitMask {
fn check_expr(&mut self, cx: &LateContext, e: &Expr) {
if let ExprBinary(ref cmp, ref left, ref right) = e.node {
if is_comparison_binop(cmp.node) {
if cmp.node.is_comparison() {
fetch_int_literal(cx, right).map_or_else(|| {
fetch_int_literal(cx, left).map_or((), |cmp_val| {
check_compare(cx,
Expand Down
2 changes: 1 addition & 1 deletion src/blacklisted_name.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use rustc::lint::*;
use rustc_front::hir::*;
use rustc::hir::*;
use utils::span_lint;

/// **What it does:** This lints about usage of blacklisted names.
Expand Down
4 changes: 2 additions & 2 deletions src/block_in_if_condition.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use rustc::lint::{LateLintPass, LateContext, LintArray, LintPass};
use rustc_front::hir::*;
use rustc_front::intravisit::{Visitor, walk_expr};
use rustc::hir::*;
use rustc::hir::intravisit::{Visitor, walk_expr};
use utils::*;

/// **What it does:** This lint checks for `if` conditions that use blocks to contain an expression.
Expand Down
4 changes: 2 additions & 2 deletions src/booleans.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use rustc::lint::{LintArray, LateLintPass, LateContext, LintPass};
use rustc_front::hir::*;
use rustc_front::intravisit::*;
use rustc::hir::*;
use rustc::hir::intravisit::*;
use syntax::ast::{LitKind, DUMMY_NODE_ID};
use syntax::codemap::{DUMMY_SP, dummy_spanned};
use utils::{span_lint_and_then, in_macro, snippet_opt, SpanlessEq};
Expand Down
2 changes: 1 addition & 1 deletion src/collapsible_if.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
//! This lint is **warn** by default
use rustc::lint::*;
use rustc_front::hir::*;
use rustc::hir::*;
use std::borrow::Cow;
use syntax::codemap::Spanned;

Expand Down
4 changes: 2 additions & 2 deletions src/consts.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#![allow(cast_possible_truncation)]

use rustc::lint::LateContext;
use rustc::middle::def::{Def, PathResolution};
use rustc::hir::def::{Def, PathResolution};
use rustc_const_eval::lookup_const_by_id;
use rustc_const_math::{ConstInt, ConstUsize, ConstIsize};
use rustc_front::hir::*;
use rustc::hir::*;
use std::cmp::Ordering::{self, Equal};
use std::cmp::PartialOrd;
use std::hash::{Hash, Hasher};
Expand Down
2 changes: 1 addition & 1 deletion src/copies.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use rustc::lint::*;
use rustc::ty;
use rustc_front::hir::*;
use rustc::hir::*;
use std::collections::HashMap;
use std::collections::hash_map::Entry;
use syntax::parse::token::InternedString;
Expand Down
4 changes: 2 additions & 2 deletions src/cyclomatic_complexity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
use rustc::lint::*;
use rustc::cfg::CFG;
use rustc::ty;
use rustc_front::hir::*;
use rustc_front::intravisit::{Visitor, walk_expr};
use rustc::hir::*;
use rustc::hir::intravisit::{Visitor, walk_expr};
use syntax::ast::Attribute;
use syntax::attr::*;
use syntax::codemap::Span;
Expand Down
2 changes: 1 addition & 1 deletion src/derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use rustc::ty::subst::Subst;
use rustc::ty::TypeVariants;
use rustc::ty::fast_reject::simplify_type;
use rustc::ty;
use rustc_front::hir::*;
use rustc::hir::*;
use syntax::ast::{Attribute, MetaItemKind};
use syntax::codemap::Span;
use utils::{CLONE_TRAIT_PATH, HASH_PATH};
Expand Down
2 changes: 1 addition & 1 deletion src/drop_ref.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use rustc::lint::*;
use rustc::ty;
use rustc_front::hir::*;
use rustc::hir::*;
use syntax::codemap::Span;
use utils::DROP_PATH;
use utils::{match_def_path, span_note_and_lint};
Expand Down
4 changes: 2 additions & 2 deletions src/entry.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use rustc::lint::*;
use rustc_front::hir::*;
use rustc_front::intravisit::{Visitor, walk_expr, walk_block};
use rustc::hir::*;
use rustc::hir::intravisit::{Visitor, walk_expr, walk_block};
use syntax::codemap::Span;
use utils::SpanlessEq;
use utils::{BTREEMAP_PATH, HASHMAP_PATH};
Expand Down
2 changes: 1 addition & 1 deletion src/enum_clike.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use rustc::lint::*;
use rustc::middle::const_val::ConstVal;
use rustc_const_math::*;
use rustc_front::hir::*;
use rustc::hir::*;
use syntax::attr::*;
use utils::span_lint;

Expand Down
6 changes: 3 additions & 3 deletions src/enum_glob_use.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
//! lint on `use`ing all variants of an enum
use rustc::front::map::Node::NodeItem;
use rustc::hir::*;
use rustc::hir::def::Def;
use rustc::hir::map::Node::NodeItem;
use rustc::lint::{LateLintPass, LintPass, LateContext, LintArray, LintContext};
use rustc::middle::def::Def;
use rustc::middle::cstore::DefLike;
use rustc_front::hir::*;
use syntax::ast::NodeId;
use syntax::codemap::Span;
use utils::span_lint;
Expand Down
5 changes: 2 additions & 3 deletions src/eq_op.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use rustc::hir::*;
use rustc::lint::*;
use rustc_front::hir::*;
use rustc_front::util as ast_util;
use utils::{SpanlessEq, span_lint};

/// **What it does:** This lint checks for equal operands to comparison, logical and bitwise,
Expand Down Expand Up @@ -34,7 +33,7 @@ impl LateLintPass for EqOp {
span_lint(cx,
EQ_OP,
e.span,
&format!("equal expressions as operands to `{}`", ast_util::binop_to_string(op.node)));
&format!("equal expressions as operands to `{}`", op.node.as_str()));
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/escape.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
use rustc::front::map::Node::{NodeExpr, NodeStmt};
use rustc::hir::*;
use rustc::hir::intravisit as visit;
use rustc::hir::map::Node::{NodeExpr, NodeStmt};
use rustc::infer;
use rustc::lint::*;
use rustc::middle::expr_use_visitor::*;
use rustc::infer;
use rustc::middle::mem_categorization::{cmt, Categorization};
use rustc::traits::ProjectionMode;
use rustc::ty::adjustment::AutoAdjustment;
use rustc::ty;
use rustc::util::nodemap::NodeSet;
use rustc_front::hir::*;
use rustc_front::intravisit as visit;
use syntax::ast::NodeId;
use syntax::codemap::Span;
use utils::span_lint;
Expand Down
2 changes: 1 addition & 1 deletion src/eta_reduction.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use rustc::lint::*;
use rustc::ty;
use rustc_front::hir::*;
use rustc::hir::*;
use utils::{snippet_opt, span_lint_and_then, is_adjusted};

#[allow(missing_copy_implementations)]
Expand Down
4 changes: 2 additions & 2 deletions src/format.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use rustc::front::map::Node::NodeItem;
use rustc::hir::map::Node::NodeItem;
use rustc::lint::*;
use rustc::ty::TypeVariants;
use rustc_front::hir::*;
use rustc::hir::*;
use syntax::ast::LitKind;
use utils::{DISPLAY_FMT_METHOD_PATH, FMT_ARGUMENTS_NEWV1_PATH, STRING_PATH};
use utils::{is_expn_of, match_path, match_type, span_lint, walk_ptrs_ty};
Expand Down
6 changes: 3 additions & 3 deletions src/functions.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use rustc::lint::*;
use rustc_front::hir;
use rustc_front::intravisit;
use rustc::hir;
use rustc::hir::intravisit;
use syntax::ast;
use syntax::codemap::Span;
use utils::span_lint;
Expand Down Expand Up @@ -45,7 +45,7 @@ impl LintPass for Functions {

impl LateLintPass for Functions {
fn check_fn(&mut self, cx: &LateContext, _: intravisit::FnKind, decl: &hir::FnDecl, _: &hir::Block, span: Span, nodeid: ast::NodeId) {
use rustc::front::map::Node::*;
use rustc::hir::map::Node::*;

if let Some(NodeItem(ref item)) = cx.tcx.map.find(cx.tcx.map.get_parent_node(nodeid)) {
match item.node {
Expand Down
2 changes: 1 addition & 1 deletion src/identity_op.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use consts::{constant_simple, Constant};
use rustc::lint::*;
use rustc_front::hir::*;
use rustc::hir::*;
use syntax::codemap::Span;
use utils::{span_lint, snippet, in_macro};
use rustc_const_math::ConstInt;
Expand Down
8 changes: 5 additions & 3 deletions src/len_zero.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use rustc::lint::*;
use rustc::middle::def_id::DefId;
use rustc::hir::def_id::DefId;
use rustc::ty::{self, MethodTraitItemId, ImplOrTraitItemId};
use rustc_front::hir::*;
use rustc::hir::*;
use syntax::ast::{Lit, LitKind, Name};
use syntax::codemap::{Span, Spanned};
use syntax::ptr::P;
Expand Down Expand Up @@ -111,6 +111,8 @@ fn check_impl_items(cx: &LateContext, item: &Item, impl_items: &[ImplItem]) {
if !impl_items.iter().any(|i| is_named_self(i, "is_empty")) {
for i in impl_items {
if is_named_self(i, "len") {
let ty = cx.tcx.node_id_to_type(item.id);

let s = i.span;
span_lint(cx,
LEN_WITHOUT_IS_EMPTY,
Expand All @@ -121,7 +123,7 @@ fn check_impl_items(cx: &LateContext, item: &Item, impl_items: &[ImplItem]) {
},
&format!("item `{}` has a `.len(_: &Self)` method, but no `.is_empty(_: &Self)` method. \
Consider adding one",
item.name));
ty));
return;
}
}
Expand Down
2 changes: 0 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ fn main() {
extern crate syntax;
#[macro_use]
extern crate rustc;
#[macro_use]
extern crate rustc_front;

extern crate toml;

Expand Down
6 changes: 3 additions & 3 deletions src/lifetimes.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use reexport::*;
use rustc::lint::*;
use rustc::middle::def::Def;
use rustc_front::hir::*;
use rustc_front::intravisit::{Visitor, walk_ty, walk_ty_param_bound, walk_fn_decl, walk_generics};
use rustc::hir::def::Def;
use rustc::hir::*;
use rustc::hir::intravisit::{Visitor, walk_ty, walk_ty_param_bound, walk_fn_decl, walk_generics};
use std::collections::{HashSet, HashMap};
use syntax::codemap::Span;
use utils::{in_external_macro, span_lint};
Expand Down
8 changes: 4 additions & 4 deletions src/loops.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
use reexport::*;
use rustc::front::map::Node::NodeBlock;
use rustc::hir::*;
use rustc::hir::def::Def;
use rustc::hir::intravisit::{Visitor, walk_expr, walk_block, walk_decl};
use rustc::hir::map::Node::NodeBlock;
use rustc::lint::*;
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;
use std::collections::HashMap;
use syntax::ast;
Expand Down
2 changes: 1 addition & 1 deletion src/map_clone.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use rustc::lint::*;
use rustc_front::hir::*;
use rustc::hir::*;
use utils::{CLONE_PATH, OPTION_PATH};
use utils::{is_adjusted, match_path, match_trait_method, match_type, snippet, span_help_and_lint, walk_ptrs_ty,
walk_ptrs_ty_depth};
Expand Down
2 changes: 1 addition & 1 deletion src/matches.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use rustc::hir::*;
use rustc::lint::*;
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 std::cmp::Ordering;
use syntax::ast::LitKind;
use syntax::codemap::Span;
Expand Down
2 changes: 1 addition & 1 deletion src/methods.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use rustc::hir::*;
use rustc::lint::*;
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;
use syntax::codemap::Span;
Expand Down
2 changes: 1 addition & 1 deletion src/minmax.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use consts::{Constant, constant_simple};
use rustc::lint::*;
use rustc_front::hir::*;
use rustc::hir::*;
use std::cmp::{PartialOrd, Ordering};
use syntax::ptr::P;
use utils::{match_def_path, span_lint};
Expand Down
11 changes: 5 additions & 6 deletions src/misc.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
use reexport::*;
use rustc::hir::*;
use rustc::hir::intravisit::FnKind;
use rustc::lint::*;
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};
use syntax::codemap::{Span, Spanned, ExpnFormat};
use syntax::ptr::P;
use utils::{get_item_name, match_path, snippet, get_parent_expr, span_lint};
Expand Down Expand Up @@ -105,7 +104,7 @@ impl LintPass for CmpNan {
impl LateLintPass for CmpNan {
fn check_expr(&mut self, cx: &LateContext, expr: &Expr) {
if let ExprBinary(ref cmp, ref left, ref right) = expr.node {
if is_comparison_binop(cmp.node) {
if cmp.node.is_comparison() {
if let ExprPath(_, ref path) = left.node {
check_nan(cx, path, expr.span);
}
Expand Down Expand Up @@ -170,7 +169,7 @@ impl LateLintPass for FloatCmp {
&format!("{}-comparison of f32 or f64 detected. Consider changing this to `({} - {}).abs() < \
epsilon` for some suitable value of epsilon. \
std::f32::EPSILON and std::f64::EPSILON are available.",
binop_to_string(op),
op.as_str(),
snippet(cx, left.span, ".."),
snippet(cx, right.span, "..")));
}
Expand Down Expand Up @@ -217,7 +216,7 @@ impl LintPass for CmpOwned {
impl LateLintPass for CmpOwned {
fn check_expr(&mut self, cx: &LateContext, expr: &Expr) {
if let ExprBinary(ref cmp, ref left, ref right) = expr.node {
if is_comparison_binop(cmp.node) {
if cmp.node.is_comparison() {
check_to_owned(cx, left, right, true, cmp.span);
check_to_owned(cx, right, left, false, cmp.span)
}
Expand Down
Loading