Update imports and rustup

This commit is contained in:
Oliver Schneider 2018-08-28 13:13:42 +02:00
parent b001ab33fe
commit d99cea0f16
111 changed files with 164 additions and 159 deletions

View File

@ -185,7 +185,7 @@ It's worth noting that the majority of `clippy_lints/src/lib.rs` is autogenerate
```rust
// ./clippy_lints/src/else_if_without_else.rs
use rustc::lint::*;
use rustc::lint::{EarlyLintPass, LintArray, LintPass};
// ...

View File

@ -1,6 +1,6 @@
use crate::utils::span_lint;
use rustc::hir::*;
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use std::f64::consts as f64;
use syntax::ast::{FloatTy, Lit, LitKind};

View File

@ -1,6 +1,6 @@
use crate::utils::span_lint;
use rustc::hir;
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use syntax::source_map::Span;

View File

@ -2,7 +2,7 @@ use crate::utils::{get_trait_def_id, implements_trait, snippet_opt, span_lint_an
use crate::utils::{higher, sugg};
use rustc::hir;
use rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor};
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use if_chain::if_chain;
use syntax::ast;
@ -133,7 +133,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AssignOps {
// the crate node is the only one that is not in the map
if_chain! {
if parent_impl != ast::CRATE_NODE_ID;
if let hir::map::Node::NodeItem(item) = cx.tcx.hir.get(parent_impl);
if let hir::Node::Item(item) = cx.tcx.hir.get(parent_impl);
if let hir::ItemKind::Impl(_, _, _, _, Some(ref trait_ref), _, _) =
item.node;
if trait_ref.path.def.def_id() == trait_id;

View File

@ -6,7 +6,7 @@ use crate::utils::{
without_block_comments,
};
use rustc::hir::*;
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use if_chain::if_chain;
use rustc::ty::{self, TyCtxt};

View File

@ -1,5 +1,5 @@
use rustc::hir::*;
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use if_chain::if_chain;
use syntax::ast::LitKind;

View File

@ -1,4 +1,4 @@
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use rustc::hir::*;
use crate::utils::span_lint;

View File

@ -1,5 +1,5 @@
use rustc::hir::*;
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use if_chain::if_chain;
use rustc::ty;

View File

@ -12,7 +12,7 @@
//!
//! This lint is **warn** by default
use rustc::lint::*;
use rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use if_chain::if_chain;
use syntax::ast;

View File

@ -1,4 +1,4 @@
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use rustc::ty::Ty;
use rustc::hir::*;

View File

@ -1,6 +1,6 @@
use crate::utils::{is_copy, match_path, paths, span_note_and_lint};
use rustc::hir::{Item, ItemKind};
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
/// **What it does:** Checks for types that implement `Copy` as well as

View File

@ -1,7 +1,7 @@
//! calculate cyclomatic complexity and warn about overly complex functions
use rustc::cfg::CFG;
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass, LintContext};
use rustc::{declare_lint, lint_array};
use rustc::hir::*;
use rustc::ty;

View File

@ -1,5 +1,5 @@
use rustc::hir::*;
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use if_chain::if_chain;
use rustc::ty::TyKind;

View File

@ -1,4 +1,4 @@
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use if_chain::if_chain;
use rustc::ty::{self, Ty};

View File

@ -1,6 +1,6 @@
use itertools::Itertools;
use pulldown_cmark;
use rustc::lint::*;
use rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use syntax::ast;
use syntax::source_map::{BytePos, Span};

View File

@ -1,7 +1,7 @@
//! Lint on unnecessary double comparisons. Some examples:
use rustc::hir::*;
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use syntax::source_map::Span;

View File

@ -1,4 +1,4 @@
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use if_chain::if_chain;
use rustc::ty;

View File

@ -1,5 +1,5 @@
use rustc::hir::*;
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use if_chain::if_chain;
use syntax::source_map::Spanned;

View File

@ -1,6 +1,6 @@
//! lint on if expressions with an else if, but without a final else branch
use rustc::lint::*;
use rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass, in_external_macro, LintContext};
use rustc::{declare_lint, lint_array};
use syntax::ast::*;

View File

@ -1,6 +1,6 @@
//! lint when there is an enum with no variants
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use rustc::hir::*;
use crate::utils::span_lint_and_then;

View File

@ -1,6 +1,6 @@
use rustc::hir::*;
use rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor};
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use if_chain::if_chain;
use syntax::source_map::Span;

View File

@ -1,7 +1,7 @@
//! lint on C-like enums that are `repr(isize/usize)` and have values that
//! don't fit into an `i32`
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use rustc::hir::*;
use rustc::ty;

View File

@ -1,6 +1,6 @@
//! lint on enum variants that are prefixed or suffixed by the same characters
use rustc::lint::*;
use rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass, Lint};
use rustc::{declare_lint, lint_array};
use syntax::ast::*;
use syntax::source_map::Span;

View File

@ -1,5 +1,5 @@
use rustc::hir::*;
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use crate::utils::{in_macro, implements_trait, is_copy, multispan_sugg, snippet, span_lint, span_lint_and_then, SpanlessEq};

View File

@ -1,6 +1,6 @@
use crate::consts::{constant_simple, Constant};
use rustc::hir::*;
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use syntax::source_map::Span;
use crate::utils::{in_macro, span_lint};

View File

@ -1,7 +1,6 @@
use rustc::hir::*;
use rustc::hir::intravisit as visit;
use rustc::hir::map::Node::{NodeExpr, NodeStmt};
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use rustc::middle::expr_use_visitor::*;
use rustc::middle::mem_categorization::{cmt_, Categorization};
@ -100,7 +99,7 @@ impl<'a, 'tcx> Delegate<'tcx> for EscapeDelegate<'a, 'tcx> {
let map = &self.cx.tcx.hir;
if map.is_argument(consume_pat.id) {
// Skip closure arguments
if let Some(NodeExpr(..)) = map.find(map.get_parent_node(consume_pat.id)) {
if let Some(Node::Expr(..)) = map.find(map.get_parent_node(consume_pat.id)) {
return;
}
if is_non_trait_box(cmt.ty) && !self.is_large_box(cmt.ty) {
@ -110,7 +109,7 @@ impl<'a, 'tcx> Delegate<'tcx> for EscapeDelegate<'a, 'tcx> {
}
if let Categorization::Rvalue(..) = cmt.cat {
let id = map.hir_to_node_id(cmt.hir_id);
if let Some(NodeStmt(st)) = map.find(map.get_parent_node(id)) {
if let Some(Node::Stmt(st)) = map.find(map.get_parent_node(id)) {
if let StmtKind::Decl(ref decl, _) = st.node {
if let DeclKind::Local(ref loc) = decl.node {
if let Some(ref ex) = loc.init {

View File

@ -1,4 +1,4 @@
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use rustc::ty;
use rustc::hir::*;

View File

@ -1,7 +1,7 @@
use rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor};
use rustc::hir::*;
use rustc::ty;
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use if_chain::if_chain;
use syntax::ast;
@ -189,9 +189,9 @@ fn check_for_unsequenced_reads(vis: &mut ReadVisitor<'_, '_>) {
};
let stop_early = match parent_node {
map::Node::NodeExpr(expr) => check_expr(vis, expr),
map::Node::NodeStmt(stmt) => check_stmt(vis, stmt),
map::Node::NodeItem(_) => {
Node::Expr(expr) => check_expr(vis, expr),
Node::Stmt(stmt) => check_stmt(vis, stmt),
Node::Item(_) => {
// We reached the top of the function, stop.
break;
},

View File

@ -1,5 +1,5 @@
use rustc::hir;
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use if_chain::if_chain;
use rustc::ty::TyKind;

View File

@ -1,5 +1,5 @@
use rustc::hir::*;
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use if_chain::if_chain;
use crate::utils::{is_expn_of, match_def_path, resolve_node, span_lint};

View File

@ -1,4 +1,4 @@
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use if_chain::if_chain;
use rustc::hir;

View File

@ -1,5 +1,5 @@
use rustc::hir::*;
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use if_chain::if_chain;
use rustc::ty;

View File

@ -1,4 +1,4 @@
use rustc::lint::*;
use rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use syntax::ast;
use crate::utils::{differing_macro_contexts, in_macro, snippet_opt, span_note_and_lint};

View File

@ -1,7 +1,7 @@
use matches::matches;
use rustc::hir::intravisit;
use rustc::hir;
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use rustc::ty;
use rustc::hir::def::Def;
@ -85,9 +85,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Functions {
span: Span,
nodeid: ast::NodeId,
) {
use rustc::hir::map::Node::*;
let is_impl = if let Some(NodeItem(item)) = cx.tcx.hir.find(cx.tcx.hir.get_parent_node(nodeid)) {
let is_impl = if let Some(hir::Node::Item(item)) = cx.tcx.hir.find(cx.tcx.hir.get_parent_node(nodeid)) {
matches!(item.node, hir::ItemKind::Impl(_, _, _, _, Some(_), _, _))
} else {
false

View File

@ -1,4 +1,4 @@
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use rustc::hir::*;
use syntax::ast::NodeId;

View File

@ -1,6 +1,6 @@
use crate::consts::{constant_simple, Constant};
use rustc::hir::*;
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use syntax::source_map::Span;
use crate::utils::{in_macro, snippet, span_lint, unsext, clip};

View File

@ -1,4 +1,4 @@
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use rustc::hir::*;
use crate::utils::{match_qpath, paths, snippet, span_lint_and_then};

View File

@ -1,7 +1,7 @@
//! lint on if branches that could be swapped so no `!` operation is necessary
//! on the condition
use rustc::lint::*;
use rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass, in_external_macro, LintContext};
use rustc::{declare_lint, lint_array};
use syntax::ast::*;

View File

@ -5,7 +5,7 @@ use crate::utils;
use crate::utils::higher;
use crate::utils::higher::Range;
use rustc::hir::*;
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use rustc::ty;
use syntax::ast::RangeLimits;

View File

@ -1,6 +1,6 @@
use super::utils::{get_arg_name, match_var, remove_blocks, snippet, span_lint_and_sugg};
use rustc::hir::*;
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use if_chain::if_chain;

View File

@ -1,5 +1,5 @@
use rustc::hir::*;
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use crate::utils::{get_trait_def_id, higher, implements_trait, match_qpath, paths, span_lint};

View File

@ -1,11 +1,12 @@
//! lint on inherent implementations
use rustc::hir::*;
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use std::collections::HashMap;
use std::default::Default;
use syntax_pos::Span;
use crate::utils::span_lint_and_then;
/// **What it does:** Checks for multiple inherent implementations of a struct
///
@ -81,12 +82,17 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
.map(|(span, _)| span);
if let Some(initial_span) = impl_spans.nth(0) {
impl_spans.for_each(|additional_span| {
cx.span_lint_note(
span_lint_and_then(
cx,
MULTIPLE_INHERENT_IMPL,
*additional_span,
"Multiple implementations of this structure",
|db| {
db.span_note(
*initial_span,
"First implementation here",
);
},
)
})
}

View File

@ -1,6 +1,6 @@
//! checks for `#[inline]` on trait methods without bodies
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use rustc::hir::*;
use syntax::ast::{Attribute, Name};

View File

@ -1,6 +1,6 @@
//! lint on blocks unnecessarily using >= with a + 1 or - 1
use rustc::lint::*;
use rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use syntax::ast::*;

View File

@ -1,4 +1,4 @@
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use if_chain::if_chain;
use rustc::ty;

View File

@ -1,7 +1,7 @@
//! lint when items are used after statements
use matches::matches;
use rustc::lint::*;
use rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use syntax::ast::*;
use crate::utils::{in_macro, span_lint};

View File

@ -1,6 +1,6 @@
//! lint when there is a large size difference between variants on an enum
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use rustc::hir::*;
use crate::utils::{snippet_opt, span_lint_and_then};

View File

@ -1,6 +1,6 @@
use rustc::hir::def_id::DefId;
use rustc::hir::*;
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use rustc::ty;
use std::collections::HashSet;

View File

@ -1,4 +1,4 @@
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use if_chain::if_chain;
use rustc::hir;

View File

@ -1,6 +1,6 @@
use crate::reexport::*;
use matches::matches;
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass, in_external_macro, LintContext};
use rustc::{declare_lint, lint_array};
use rustc::hir::def::Def;
use rustc::hir::*;

View File

@ -1,7 +1,7 @@
//! Lints concerned with the grouping of digits with underscores in integral or
//! floating-point literal expressions.
use rustc::lint::*;
use rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass, in_external_macro, LintContext};
use rustc::{declare_lint, lint_array};
use if_chain::if_chain;
use syntax::ast::*;

View File

@ -4,8 +4,7 @@ use rustc::hir::*;
use rustc::hir::def::Def;
use rustc::hir::def_id;
use rustc::hir::intravisit::{walk_block, walk_decl, walk_expr, walk_pat, walk_stmt, NestedVisitorMap, Visitor};
use rustc::hir::map::Node::{NodeBlock, NodeExpr, NodeStmt};
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass, in_external_macro, LintContext};
use rustc::{declare_lint, lint_array};
use if_chain::if_chain;
use rustc::middle::region;
@ -1330,7 +1329,7 @@ fn check_for_loop_explicit_counter<'a, 'tcx>(
let parent_scope = map.get_enclosing_scope(expr.id)
.and_then(|id| map.get_enclosing_scope(id));
if let Some(parent_id) = parent_scope {
if let NodeBlock(block) = map.get(parent_id) {
if let Node::Block(block) = map.get(parent_id) {
for (id, _) in visitor
.states
.iter()
@ -1506,7 +1505,7 @@ fn check_for_mutability(cx: &LateContext<'_, '_>, bound: &Expr) -> Option<NodeId
if let Def::Local(node_id) = def {
let node_str = cx.tcx.hir.get(node_id);
if_chain! {
if let map::Node::NodeBinding(pat) = node_str;
if let Node::Binding(pat) = node_str;
if let PatKind::Binding(bind_ann, _, _, _) = pat.node;
if let BindingAnnotation::Mutable = bind_ann;
then {
@ -2047,7 +2046,7 @@ fn is_conditional(expr: &Expr) -> bool {
fn is_nested(cx: &LateContext<'_, '_>, match_expr: &Expr, iter_expr: &Expr) -> bool {
if_chain! {
if let Some(loop_block) = get_enclosing_block(cx, match_expr.id);
if let Some(map::Node::NodeExpr(loop_expr)) = cx.tcx.hir.find(cx.tcx.hir.get_parent_node(loop_block.id));
if let Some(Node::Expr(loop_expr)) = cx.tcx.hir.find(cx.tcx.hir.get_parent_node(loop_block.id));
then {
return is_loop_nested(cx, loop_expr, iter_expr)
}
@ -2068,13 +2067,13 @@ fn is_loop_nested(cx: &LateContext<'_, '_>, loop_expr: &Expr, iter_expr: &Expr)
return false;
}
match cx.tcx.hir.find(parent) {
Some(NodeExpr(expr)) => match expr.node {
Some(Node::Expr(expr)) => match expr.node {
ExprKind::Loop(..) | ExprKind::While(..) => {
return true;
},
_ => (),
},
Some(NodeBlock(block)) => {
Some(Node::Block(block)) => {
let mut block_visitor = LoopNestVisitor {
id,
iterator: iter_name,
@ -2085,7 +2084,7 @@ fn is_loop_nested(cx: &LateContext<'_, '_>, loop_expr: &Expr, iter_expr: &Expr)
return false;
}
},
Some(NodeStmt(_)) => (),
Some(Node::Stmt(_)) => (),
_ => {
return false;
},

View File

@ -1,4 +1,4 @@
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use if_chain::if_chain;
use rustc::hir::*;

View File

@ -1,5 +1,5 @@
use rustc::hir;
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use if_chain::if_chain;
use rustc::ty;

View File

@ -1,5 +1,5 @@
use rustc::hir::*;
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass, in_external_macro, LintContext};
use rustc::{declare_lint, lint_array};
use if_chain::if_chain;
use rustc::ty::{self, Ty};

View File

@ -1,4 +1,4 @@
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use rustc::hir::{Expr, ExprKind};
use crate::utils::{match_def_path, opt_def_id, paths, span_lint};

View File

@ -1,6 +1,6 @@
use matches::matches;
use rustc::hir;
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass, in_external_macro, Lint, LintContext};
use rustc::{declare_lint, lint_array};
use if_chain::if_chain;
use rustc::ty::{self, Ty};
@ -1145,14 +1145,14 @@ fn lint_clone_on_copy(cx: &LateContext<'_, '_>, expr: &hir::Expr, arg: &hir::Exp
if let ty::Ref(..) = cx.tables.expr_ty(arg).sty {
let parent = cx.tcx.hir.get_parent_node(expr.id);
match cx.tcx.hir.get(parent) {
hir::map::NodeExpr(parent) => match parent.node {
hir::Node::Expr(parent) => match parent.node {
// &*x is a nop, &x.clone() is not
hir::ExprKind::AddrOf(..) |
// (*x).func() is useless, x.clone().func() can work in case func borrows mutably
hir::ExprKind::MethodCall(..) => return,
_ => {},
}
hir::map::NodeStmt(stmt) => {
hir::Node::Stmt(stmt) => {
if let hir::StmtKind::Decl(ref decl, _) = stmt.node {
if let hir::DeclKind::Local(ref loc) = decl.node {
if let hir::PatKind::Ref(..) = loc.pat.node {

View File

@ -1,7 +1,7 @@
use crate::consts::{constant_simple, Constant};
use crate::utils::{match_def_path, opt_def_id, paths, span_lint};
use rustc::hir::*;
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use std::cmp::Ordering;

View File

@ -2,7 +2,7 @@ use crate::reexport::*;
use matches::matches;
use rustc::hir::*;
use rustc::hir::intravisit::FnKind;
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use if_chain::if_chain;
use rustc::ty;
@ -522,7 +522,7 @@ fn check_to_owned(cx: &LateContext<'_, '_>, expr: &Expr, other: &Expr) {
let parent_fn = cx.tcx.hir.get_parent(expr.id);
let parent_impl = cx.tcx.hir.get_parent(parent_fn);
if parent_impl != CRATE_NODE_ID {
if let map::NodeItem(item) = cx.tcx.hir.get(parent_impl) {
if let Node::Item(item) = cx.tcx.hir.get(parent_impl) {
if let ItemKind::Impl(.., Some(ref trait_ref), _, _) = item.node {
if trait_ref.path.def.def_id() == partial_eq_trait_id {
// we are implementing PartialEq, don't suggest not doing `to_owned`, otherwise

View File

@ -1,4 +1,4 @@
use rustc::lint::*;
use rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass, LintContext, in_external_macro};
use rustc::{declare_lint, lint_array};
use if_chain::if_chain;
use std::collections::HashMap;

View File

@ -19,13 +19,13 @@
//
use rustc::hir;
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass, LintContext};
use rustc::{declare_lint, lint_array};
use rustc::ty;
use syntax::ast;
use syntax::attr;
use syntax::source_map::Span;
use crate::utils::in_macro;
use crate::utils::{span_lint, in_macro};
/// **What it does:** Warns if there is missing doc for any documentable item
/// (public or private).
@ -87,7 +87,8 @@ impl MissingDoc {
.iter()
.any(|a| a.is_value_str() && a.name() == "doc");
if !has_doc {
cx.span_lint(
span_lint(
cx,
MISSING_DOCS_IN_PRIVATE_ITEMS,
sp,
&format!("missing documentation for {}", desc),

View File

@ -10,10 +10,11 @@
//
use rustc::hir;
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use syntax::ast;
use syntax::source_map::Span;
use crate::utils::span_lint;
/// **What it does:** it lints if an exported function, method, trait method with default impl,
/// or trait method impl is not `#[inline]`.
@ -74,7 +75,8 @@ fn check_missing_inline_attrs(cx: &LateContext<'_, '_>,
.iter()
.any(|a| a.name() == "inline" );
if !has_inline {
cx.span_lint(
span_lint(
cx,
MISSING_INLINE_IN_PUBLIC_ITEMS,
sp,
&format!("missing `#[inline]` for {}", desc),

View File

@ -1,8 +1,9 @@
//! lint on multiple versions of a crate being used
use rustc::lint::*;
use rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use syntax::ast::*;
use crate::utils::span_lint;
use cargo_metadata;
use itertools::Itertools;
@ -43,7 +44,8 @@ impl EarlyLintPass for Pass {
let metadata = match cargo_metadata::metadata_deps(None, true) {
Ok(metadata) => metadata,
Err(_) => {
cx.span_lint(
span_lint(
cx,
MULTIPLE_CRATE_VERSIONS,
krate.span,
"could not read cargo metadata"
@ -62,7 +64,8 @@ impl EarlyLintPass for Pass {
if group.len() > 1 {
let versions = group.into_iter().map(|p| p.version).join(", ");
cx.span_lint(
span_lint(
cx,
MULTIPLE_CRATE_VERSIONS,
krate.span,
&format!("multiple versions for dependency `{}`: {}", name, versions),

View File

@ -1,6 +1,6 @@
use rustc::hir;
use rustc::hir::intravisit;
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass, in_external_macro, LintContext};
use rustc::{declare_lint, lint_array};
use rustc::ty;
use crate::utils::{higher, span_lint};

View File

@ -1,4 +1,4 @@
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use rustc::ty::{self, Ty};
use rustc::ty::subst::Subst;

View File

@ -2,7 +2,7 @@
//!
//! This lint is **warn** by default
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use rustc::hir::*;
use syntax::ast::LitKind;

View File

@ -2,7 +2,7 @@
//!
//! This lint is **warn** by default
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use if_chain::if_chain;
use rustc::hir::{BindingAnnotation, Expr, ExprKind, MutImmutable, Pat, PatKind};

View File

@ -2,7 +2,7 @@
//!
//! This lint is **warn** by default
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use if_chain::if_chain;
use rustc::hir::{BindingAnnotation, MutImmutable, Pat, PatKind};

View File

@ -27,7 +27,7 @@
//! ```
//!
//! This lint is **warn** by default.
use rustc::lint::*;
use rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use syntax::ast;
use syntax::source_map::{original_sp, DUMMY_SP};

View File

@ -1,8 +1,7 @@
use matches::matches;
use rustc::hir::*;
use rustc::hir::map::*;
use rustc::hir::intravisit::FnKind;
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use if_chain::if_chain;
use rustc::ty::{self, RegionKind, TypeFoldable};
@ -90,7 +89,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NeedlessPassByValue {
}
// Exclude non-inherent impls
if let Some(NodeItem(item)) = cx.tcx.hir.find(cx.tcx.hir.get_parent_node(node_id)) {
if let Some(Node::Item(item)) = cx.tcx.hir.find(cx.tcx.hir.get_parent_node(node_id)) {
if matches!(item.node, ItemKind::Impl(_, _, _, _, Some(_), _, _) |
ItemKind::Trait(..))
{
@ -340,7 +339,7 @@ impl<'a, 'tcx> MovedVariablesCtxt<'a, 'tcx> {
if let Some(node) = self.cx.tcx.hir.find(id) {
match node {
map::Node::NodeExpr(e) => {
Node::Expr(e) => {
// `match` and `if let`
if let ExprKind::Match(ref c, ..) = e.node {
self.spans_need_deref
@ -350,7 +349,7 @@ impl<'a, 'tcx> MovedVariablesCtxt<'a, 'tcx> {
}
},
map::Node::NodeStmt(s) => {
Node::Stmt(s) => {
// `let <pat> = x;`
if_chain! {
if let StmtKind::Decl(ref decl, _) = s.node;

View File

@ -1,5 +1,5 @@
use rustc::hir::*;
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass, in_external_macro, LintContext};
use rustc::{declare_lint, lint_array};
use if_chain::if_chain;

View File

@ -1,5 +1,5 @@
use rustc::hir::*;
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use if_chain::if_chain;
use syntax::source_map::{Span, Spanned};

View File

@ -1,6 +1,6 @@
use rustc::hir::def_id::DefId;
use rustc::hir;
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass, in_external_macro, LintContext};
use rustc::{declare_lint, lint_array};
use if_chain::if_chain;
use rustc::ty::{self, Ty};

View File

@ -212,7 +212,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonCopyConst {
if parent_id == cur_expr.id {
break;
}
if let Some(map::NodeExpr(parent_expr)) = cx.tcx.hir.find(parent_id) {
if let Some(Node::Expr(parent_expr)) = cx.tcx.hir.find(parent_id) {
match &parent_expr.node {
ExprKind::AddrOf(..) => {
// `&e` => `e` must be referenced

View File

@ -1,4 +1,4 @@
use rustc::lint::*;
use rustc::lint::{LintArray, LintPass, EarlyContext, EarlyLintPass};
use rustc::{declare_lint, lint_array};
use syntax::source_map::Span;
use syntax::symbol::LocalInternedString;

View File

@ -1,4 +1,4 @@
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use if_chain::if_chain;
use rustc::hir::*;

View File

@ -1,5 +1,5 @@
use rustc::hir::{Expr, ExprKind};
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use syntax::ast::LitKind;
use syntax::source_map::{Span, Spanned};

View File

@ -1,4 +1,4 @@
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use if_chain::if_chain;
use rustc::hir::*;

View File

@ -1,5 +1,5 @@
use rustc::hir::*;
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use if_chain::if_chain;
use syntax::ast::LitKind;

View File

@ -1,4 +1,4 @@
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use if_chain::if_chain;
use rustc::hir::*;

View File

@ -1,4 +1,4 @@
use rustc::lint::*;
use rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use syntax::ast::*;
use syntax::source_map::Spanned;

View File

@ -2,9 +2,8 @@
use std::borrow::Cow;
use rustc::hir::*;
use rustc::hir::map::NodeItem;
use rustc::hir::QPath;
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use if_chain::if_chain;
use rustc::ty;
@ -112,7 +111,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for PointerPass {
fn check_impl_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx ImplItem) {
if let ImplItemKind::Method(ref sig, body_id) = item.node {
if let Some(NodeItem(it)) = cx.tcx.hir.find(cx.tcx.hir.get_parent(item.id)) {
if let Some(Node::Item(it)) = cx.tcx.hir.find(cx.tcx.hir.get_parent(item.id)) {
if let ItemKind::Impl(_, _, _, _, Some(_), _, _) = it.node {
return; // ignore trait impls
}

View File

@ -1,4 +1,4 @@
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use if_chain::if_chain;
use rustc::hir::*;

View File

@ -1,4 +1,4 @@
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use if_chain::if_chain;
use rustc::hir::*;

View File

@ -1,4 +1,4 @@
use rustc::lint::*;
use rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use syntax::ast::*;
use crate::utils::{span_lint_and_sugg};

View File

@ -1,5 +1,5 @@
use syntax::ast::{Expr, ExprKind, UnOp};
use rustc::lint::*;
use rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use if_chain::if_chain;
use crate::utils::{snippet, span_lint_and_sugg};

View File

@ -1,6 +1,6 @@
use regex_syntax;
use rustc::hir::*;
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use if_chain::if_chain;
use std::collections::HashSet;

View File

@ -1,4 +1,4 @@
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use if_chain::if_chain;
use rustc::hir;

View File

@ -1,4 +1,4 @@
use rustc::lint::*;
use rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass, in_external_macro, LintContext};
use rustc::{declare_lint, lint_array};
use if_chain::if_chain;
use syntax::ast;

View File

@ -1,4 +1,4 @@
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use rustc::hir::*;
use crate::utils::{get_trait_def_id, paths, span_lint};

View File

@ -1,5 +1,5 @@
use crate::reexport::*;
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass, in_external_macro, LintContext};
use rustc::{declare_lint, lint_array};
use rustc::hir::*;
use rustc::hir::intravisit::FnKind;

View File

@ -1,5 +1,5 @@
use rustc::hir::*;
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use syntax::source_map::Spanned;
use crate::utils::SpanlessEq;

View File

@ -1,4 +1,4 @@
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use if_chain::if_chain;
use rustc::hir;
@ -76,7 +76,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for SuspiciousImpl {
// as a child node
let mut parent_expr = cx.tcx.hir.get_parent_node(expr.id);
while parent_expr != ast::CRATE_NODE_ID {
if let hir::map::Node::NodeExpr(e) = cx.tcx.hir.get(parent_expr) {
if let hir::Node::Expr(e) = cx.tcx.hir.get(parent_expr) {
match e.node {
hir::ExprKind::Binary(..)
| hir::ExprKind::Unary(hir::UnOp::UnNot, _)
@ -187,7 +187,7 @@ fn check_binop<'a>(
if_chain! {
if parent_impl != ast::CRATE_NODE_ID;
if let hir::map::Node::NodeItem(item) = cx.tcx.hir.get(parent_impl);
if let hir::Node::Item(item) = cx.tcx.hir.get(parent_impl);
if let hir::ItemKind::Impl(_, _, _, _, Some(ref trait_ref), _, _) = item.node;
if let Some(idx) = trait_ids.iter().position(|&tid| tid == trait_ref.path.def.def_id());
if binop != expected_ops[idx];

View File

@ -1,6 +1,6 @@
use matches::matches;
use rustc::hir::*;
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use if_chain::if_chain;
use rustc::ty;

View File

@ -1,4 +1,4 @@
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use if_chain::if_chain;
use rustc::ty::{self, Ty};

View File

@ -3,9 +3,8 @@ use std::cmp;
use matches::matches;
use rustc::hir;
use rustc::hir::*;
use rustc::hir::map::*;
use rustc::hir::intravisit::FnKind;
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use if_chain::if_chain;
use rustc::ty::TyKind;
@ -109,7 +108,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TriviallyCopyPassByRef {
}
// Exclude non-inherent impls
if let Some(NodeItem(item)) = cx.tcx.hir.find(cx.tcx.hir.get_parent_node(node_id)) {
if let Some(Node::Item(item)) = cx.tcx.hir.find(cx.tcx.hir.get_parent_node(node_id)) {
if matches!(item.node, ItemKind::Impl(_, _, _, _, Some(_), _, _) |
ItemKind::Trait(..))
{

View File

@ -2,7 +2,7 @@ use crate::reexport::*;
use rustc::hir;
use rustc::hir::*;
use rustc::hir::intravisit::{walk_body, walk_expr, walk_ty, FnKind, NestedVisitorMap, Visitor};
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass, in_external_macro, LintContext};
use rustc::{declare_lint, lint_array};
use if_chain::if_chain;
use rustc::ty::{self, Ty, TyCtxt, TypeckTables};
@ -140,7 +140,7 @@ impl LintPass for TypePass {
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypePass {
fn check_fn(&mut self, cx: &LateContext<'_, '_>, _: FnKind<'_>, decl: &FnDecl, _: &Body, _: Span, id: NodeId) {
// skip trait implementations, see #605
if let Some(map::NodeItem(item)) = cx.tcx.hir.find(cx.tcx.hir.get_parent(id)) {
if let Some(hir::Node::Item(item)) = cx.tcx.hir.find(cx.tcx.hir.get_parent(id)) {
if let ItemKind::Impl(_, _, _, _, Some(..), _, _) = item.node {
return;
}
@ -514,7 +514,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnitArg {
if !is_questionmark_desugar_marked_call(expr) {
if_chain!{
let opt_parent_node = map.find(map.get_parent_node(expr.id));
if let Some(hir::map::NodeExpr(parent_expr)) = opt_parent_node;
if let Some(hir::Node::Expr(parent_expr)) = opt_parent_node;
if is_questionmark_desugar_marked_call(parent_expr);
then {}
else {

View File

@ -1,4 +1,4 @@
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use rustc::hir::*;
use syntax::ast::{LitKind, NodeId};

View File

@ -1,4 +1,4 @@
use rustc::lint::*;
use rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use syntax::ast::*;
use syntax::source_map::Span;

View File

@ -1,4 +1,4 @@
use rustc::lint::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint, lint_array};
use rustc::hir;
use crate::utils::{is_try, match_qpath, match_trait_method, paths, span_lint};

Some files were not shown because too many files have changed in this diff Show More