Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnTitor authored and defunctio committed Jan 7, 2020
1 parent 390eacf commit 238649c
Show file tree
Hide file tree
Showing 140 changed files with 231 additions and 218 deletions.
2 changes: 1 addition & 1 deletion clippy_lints/src/approx_const.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::utils::span_lint;
use rustc::declare_lint_pass;
use rustc::hir::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc_hir::*;
use rustc_session::declare_tool_lint;
use rustc_span::symbol;
use std::f64::consts as f64;
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/arithmetic.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use crate::consts::constant_simple;
use crate::utils::span_lint;
use rustc::hir;
use rustc::impl_lint_pass;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc_hir as hir;
use rustc_session::declare_tool_lint;
use rustc_span::source_map::Span;

Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/assertions_on_constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use crate::utils::paths;
use crate::utils::{is_direct_expn_of, is_expn_of, match_function_call, snippet_opt, span_help_and_lint};
use if_chain::if_chain;
use rustc::declare_lint_pass;
use rustc::hir::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc_hir::*;
use rustc_session::declare_tool_lint;
use syntax::ast::LitKind;

Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/assign_ops.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use if_chain::if_chain;
use rustc::declare_lint_pass;
use rustc::hir;
use rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor};
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc_errors::Applicability;
use rustc_hir as hir;
use rustc_session::declare_tool_lint;

use crate::utils::{
Expand Down Expand Up @@ -232,7 +232,7 @@ fn lint_misrefactored_assign_op(

#[must_use]
fn is_commutative(op: hir::BinOpKind) -> bool {
use rustc::hir::BinOpKind::*;
use rustc_hir::BinOpKind::*;
match op {
Add | Mul | And | Or | BitXor | BitAnd | BitOr | Eq | Ne => true,
Sub | Div | Rem | Shl | Shr | Lt | Le | Ge | Gt => false,
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ use crate::utils::{
};
use if_chain::if_chain;
use rustc::declare_lint_pass;
use rustc::hir::*;
use rustc::lint::{
in_external_macro, CheckLintNameResult, EarlyContext, EarlyLintPass, LateContext, LateLintPass, LintArray,
LintContext, LintPass,
};
use rustc::ty;
use rustc_errors::Applicability;
use rustc_hir::*;
use rustc_session::declare_tool_lint;
use rustc_span::source_map::Span;
use rustc_span::symbol::Symbol;
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/bit_mask.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ use crate::consts::{constant, Constant};
use crate::utils::sugg::Sugg;
use crate::utils::{span_lint, span_lint_and_then};
use if_chain::if_chain;
use rustc::hir::*;
use rustc::impl_lint_pass;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc_errors::Applicability;
use rustc_hir::*;
use rustc_session::declare_tool_lint;
use rustc_span::source_map::Span;
use syntax::ast::LitKind;
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/blacklisted_name.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use crate::utils::span_lint;
use rustc::hir::*;
use rustc::impl_lint_pass;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc_data_structures::fx::FxHashSet;
use rustc_hir::*;
use rustc_session::declare_tool_lint;

declare_clippy_lint! {
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/block_in_if_condition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use crate::utils::*;
use matches::matches;
use rustc::declare_lint_pass;
use rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor};
use rustc::hir::*;
use rustc::lint::{in_external_macro, LateContext, LateLintPass, LintArray, LintContext, LintPass};
use rustc_hir::*;
use rustc_session::declare_tool_lint;

declare_clippy_lint! {
Expand Down Expand Up @@ -78,7 +78,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for BlockInIfCondition {
}
if let Some((check, then, _)) = higher::if_block(&expr) {
if let ExprKind::Block(block, _) = &check.kind {
if block.rules == DefaultBlock {
if block.rules == BlockCheckMode::DefaultBlock {
if block.stmts.is_empty() {
if let Some(ex) = &block.expr {
// don't dig into the expression here, just suggest that they remove
Expand Down
9 changes: 5 additions & 4 deletions clippy_lints/src/booleans.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ use crate::utils::{
};
use if_chain::if_chain;
use rustc::declare_lint_pass;
use rustc::hir::intravisit;
use rustc::hir::intravisit::*;
use rustc::hir::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc_errors::Applicability;
use rustc_hir::*;
use rustc_session::declare_tool_lint;
use rustc_span::source_map::Span;
use syntax::ast::LitKind;
Expand Down Expand Up @@ -109,7 +110,7 @@ impl<'a, 'tcx, 'v> Hir2Qmm<'a, 'tcx, 'v> {
// prevent folding of `cfg!` macros and the like
if !e.span.from_expansion() {
match &e.kind {
ExprKind::Unary(UnNot, inner) => return Ok(Bool::Not(box self.run(inner)?)),
ExprKind::Unary(UnOp::UnNot, inner) => return Ok(Bool::Not(box self.run(inner)?)),
ExprKind::Binary(binop, lhs, rhs) => match &binop.node {
BinOpKind::Or => return Ok(Bool::Or(self.extract(BinOpKind::Or, &[lhs, rhs], Vec::new())?)),
BinOpKind::And => return Ok(Bool::And(self.extract(BinOpKind::And, &[lhs, rhs], Vec::new())?)),
Expand Down Expand Up @@ -445,7 +446,7 @@ impl<'a, 'tcx> Visitor<'tcx> for NonminimalBoolVisitor<'a, 'tcx> {
ExprKind::Binary(binop, _, _) if binop.node == BinOpKind::Or || binop.node == BinOpKind::And => {
self.bool_expr(e)
},
ExprKind::Unary(UnNot, inner) => {
ExprKind::Unary(UnOp::UnNot, inner) => {
if self.cx.tables.node_types()[inner.hir_id].is_bool() {
self.bool_expr(e);
} else {
Expand All @@ -471,7 +472,7 @@ struct NotSimplificationVisitor<'a, 'tcx> {

impl<'a, 'tcx> Visitor<'tcx> for NotSimplificationVisitor<'a, 'tcx> {
fn visit_expr(&mut self, expr: &'tcx Expr<'_>) {
if let ExprKind::Unary(UnNot, inner) = &expr.kind {
if let ExprKind::Unary(UnOp::UnNot, inner) = &expr.kind {
if let Some(suggestion) = simplify_not(self.cx, inner) {
span_lint_and_sugg(
self.cx,
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/bytecount.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ use crate::utils::{
};
use if_chain::if_chain;
use rustc::declare_lint_pass;
use rustc::hir::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::ty;
use rustc_errors::Applicability;
use rustc_hir::*;
use rustc_session::declare_tool_lint;
use syntax::ast::{Name, UintTy};

Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/checked_conversions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
use if_chain::if_chain;
use rustc::declare_lint_pass;
use rustc::hir::*;
use rustc::lint::{in_external_macro, LateContext, LateLintPass, LintArray, LintContext, LintPass};
use rustc_errors::Applicability;
use rustc_hir::*;
use rustc_session::declare_tool_lint;
use syntax::ast::LitKind;

Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/cognitive_complexity.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
//! calculate cognitive complexity and warn about overly complex functions
use rustc::hir::intravisit::{walk_expr, FnKind, NestedVisitorMap, Visitor};
use rustc::hir::*;
use rustc::impl_lint_pass;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintContext, LintPass};
use rustc_hir::*;
use rustc_session::declare_tool_lint;
use rustc_span::source_map::Span;
use rustc_span::BytePos;
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/comparison_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use crate::utils::{
get_trait_def_id, if_sequence, implements_trait, parent_node_is_if_expr, paths, span_help_and_lint, SpanlessEq,
};
use rustc::declare_lint_pass;
use rustc::hir::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc_hir::*;
use rustc_session::declare_tool_lint;

declare_clippy_lint! {
Expand Down
10 changes: 5 additions & 5 deletions clippy_lints/src/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

use crate::utils::{clip, higher, sext, unsext};
use if_chain::if_chain;
use rustc::hir::def::{DefKind, Res};
use rustc::hir::*;
use rustc::lint::LateContext;
use rustc::ty::subst::{Subst, SubstsRef};
use rustc::ty::{self, Ty, TyCtxt};
use rustc::{bug, span_bug};
use rustc_data_structures::sync::Lrc;
use rustc_hir::def::{DefKind, Res};
use rustc_hir::*;
use rustc_span::symbol::Symbol;
use std::cmp::Ordering::{self, Equal};
use std::cmp::PartialOrd;
Expand Down Expand Up @@ -240,9 +240,9 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> {
self.expr(value).map(|v| Constant::Repeat(Box::new(v), n))
},
ExprKind::Unary(op, ref operand) => self.expr(operand).and_then(|o| match op {
UnNot => self.constant_not(&o, self.tables.expr_ty(e)),
UnNeg => self.constant_negate(&o, self.tables.expr_ty(e)),
UnDeref => Some(o),
UnOp::UnNot => self.constant_not(&o, self.tables.expr_ty(e)),
UnOp::UnNeg => self.constant_negate(&o, self.tables.expr_ty(e)),
UnOp::UnDeref => Some(o),
}),
ExprKind::Binary(op, ref left, ref right) => self.binop(op, left, right),
ExprKind::Call(ref callee, ref args) => {
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/copies.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use crate::utils::{get_parent_expr, higher, if_sequence, same_tys, snippet, span_lint_and_then, span_note_and_lint};
use crate::utils::{SpanlessEq, SpanlessHash};
use rustc::declare_lint_pass;
use rustc::hir::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::ty::Ty;
use rustc_data_structures::fx::FxHashMap;
use rustc_hir::*;
use rustc_session::declare_tool_lint;
use rustc_span::symbol::Symbol;
use std::collections::hash_map::Entry;
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/copy_iterator.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::utils::{is_copy, match_path, paths, span_note_and_lint};
use rustc::declare_lint_pass;
use rustc::hir::{Item, ItemKind};
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc_hir::{Item, ItemKind};
use rustc_session::declare_tool_lint;

declare_clippy_lint! {
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/default_trait_access.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use if_chain::if_chain;
use rustc::declare_lint_pass;
use rustc::hir::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::ty;
use rustc_errors::Applicability;
use rustc_hir::*;
use rustc_session::declare_tool_lint;

use crate::utils::{any_parent_is_automatically_derived, match_def_path, paths, span_lint_and_sugg};
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ use crate::utils::paths;
use crate::utils::{is_automatically_derived, is_copy, match_path, span_lint_and_then};
use if_chain::if_chain;
use rustc::declare_lint_pass;
use rustc::hir::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::ty::{self, Ty};
use rustc_hir::*;
use rustc_session::declare_tool_lint;
use rustc_span::source_map::Span;

Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/doc.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use crate::utils::{match_type, paths, return_ty, span_lint};
use itertools::Itertools;
use rustc::hir;
use rustc::impl_lint_pass;
use rustc::lint::{in_external_macro, LateContext, LateLintPass, LintArray, LintPass};
use rustc_data_structures::fx::FxHashSet;
use rustc_hir as hir;
use rustc_session::declare_tool_lint;
use rustc_span::source_map::{BytePos, MultiSpan, Span};
use rustc_span::Pos;
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/double_comparison.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
//! Lint on unnecessary double comparisons. Some examples:
use rustc::declare_lint_pass;
use rustc::hir::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc_errors::Applicability;
use rustc_hir::*;
use rustc_session::declare_tool_lint;
use rustc_span::source_map::Span;

Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/drop_bounds.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use crate::utils::{match_def_path, paths, span_lint};
use if_chain::if_chain;
use rustc::declare_lint_pass;
use rustc::hir::*;
use rustc::lint::{LateLintPass, LintArray, LintPass};
use rustc_hir::*;
use rustc_session::declare_tool_lint;

declare_clippy_lint! {
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/drop_forget_ref.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use crate::utils::{is_copy, match_def_path, paths, qpath_res, span_note_and_lint};
use if_chain::if_chain;
use rustc::declare_lint_pass;
use rustc::hir::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::ty;
use rustc_hir::*;
use rustc_session::declare_tool_lint;

declare_clippy_lint! {
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/duration_subsec.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use if_chain::if_chain;
use rustc::declare_lint_pass;
use rustc::hir::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc_errors::Applicability;
use rustc_hir::*;
use rustc_session::declare_tool_lint;
use rustc_span::source_map::Spanned;

Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/empty_enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
use crate::utils::span_lint_and_then;
use rustc::declare_lint_pass;
use rustc::hir::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc_hir::*;
use rustc_session::declare_tool_lint;

declare_clippy_lint! {
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ use crate::utils::{snippet_with_applicability, span_lint_and_then, walk_ptrs_ty}
use if_chain::if_chain;
use rustc::declare_lint_pass;
use rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor};
use rustc::hir::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc_errors::Applicability;
use rustc_hir::*;
use rustc_session::declare_tool_lint;
use rustc_span::source_map::Span;

Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/enum_clike.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
use crate::consts::{miri_to_const, Constant};
use crate::utils::span_lint;
use rustc::declare_lint_pass;
use rustc::hir::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::ty;
use rustc::ty::util::IntTypeExt;
use rustc_hir::*;
use rustc_session::declare_tool_lint;
use std::convert::TryFrom;
use syntax::ast::{IntTy, UintTy};
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/enum_glob_use.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
use crate::utils::span_lint;
use rustc::declare_lint_pass;
use rustc::hir::def::{DefKind, Res};
use rustc::hir::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc_hir::def::{DefKind, Res};
use rustc_hir::*;
use rustc_session::declare_tool_lint;
use rustc_span::source_map::Span;

Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/eq_op.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use crate::utils::{implements_trait, is_copy, multispan_sugg, snippet, span_lint, span_lint_and_then, SpanlessEq};
use rustc::declare_lint_pass;
use rustc::hir::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc_errors::Applicability;
use rustc_hir::*;
use rustc_session::declare_tool_lint;

declare_clippy_lint! {
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/erasing_op.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use rustc::declare_lint_pass;
use rustc::hir::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc_hir::*;
use rustc_session::declare_tool_lint;
use rustc_span::source_map::Span;

Expand Down
6 changes: 3 additions & 3 deletions clippy_lints/src/escape.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use rustc::hir::intravisit as visit;
use rustc::hir::HirIdSet;
use rustc::hir::{self, *};
use rustc::impl_lint_pass;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::ty::layout::LayoutOf;
use rustc::ty::{self, Ty};
use rustc_hir::HirIdSet;
use rustc_hir::{self, *};
use rustc_session::declare_tool_lint;
use rustc_span::source_map::Span;
use rustc_typeck::expr_use_visitor::*;
Expand Down Expand Up @@ -93,7 +93,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for BoxedLocal {
}

// TODO: Replace with Map::is_argument(..) when it's fixed
fn is_argument(map: &hir::map::Map<'_>, id: HirId) -> bool {
fn is_argument(map: &rustc::hir::map::Map<'_>, id: HirId) -> bool {
match map.find(id) {
Some(Node::Binding(_)) => (),
_ => return false,
Expand Down
Loading

0 comments on commit 238649c

Please sign in to comment.