Skip to content

Commit

Permalink
Fix fallout
Browse files Browse the repository at this point in the history
  • Loading branch information
flip1995 committed Jan 9, 2020
1 parent 321d64a commit 7e834c8
Show file tree
Hide file tree
Showing 121 changed files with 224 additions and 167 deletions.
2 changes: 1 addition & 1 deletion clippy_dev/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use regex::Regex;
use std::collections::HashMap;
use std::ffi::OsStr;
use std::fs;
use std::io::prelude::*;
use std::io::prelude::{Read, Write};
use walkdir::WalkDir;

lazy_static! {
Expand Down
5 changes: 4 additions & 1 deletion clippy_dev/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#![cfg_attr(feature = "deny-warnings", deny(warnings))]

use clap::{App, Arg, SubCommand};
use clippy_dev::*;
use clippy_dev::{
gather_all, gen_changelog_lint_list, gen_deprecated, gen_lint_group_list, gen_modules_list, gen_register_lint_list,
replace_region_in_file, Lint,
};

mod fmt;
mod stderr_length_check;
Expand Down
2 changes: 1 addition & 1 deletion clippy_dev/src/stderr_length_check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::ffi::OsStr;
use walkdir::WalkDir;

use std::fs::File;
use std::io::prelude::*;
use std::io::prelude::Read;

// The maximum length allowed for stderr files.
//
Expand Down
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::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc_hir::*;
use rustc_hir::{Expr, ExprKind};
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/as_conversions.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use rustc::declare_lint_pass;
use rustc::lint::{in_external_macro, EarlyContext, EarlyLintPass, LintArray, LintContext, LintPass};
use rustc_session::declare_tool_lint;
use syntax::ast::*;
use syntax::ast::{Expr, ExprKind};

use crate::utils::span_help_and_lint;

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 @@ -4,7 +4,7 @@ use crate::utils::{is_direct_expn_of, is_expn_of, match_function_call, snippet_o
use if_chain::if_chain;
use rustc::declare_lint_pass;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc_hir::*;
use rustc_hir::{Expr, ExprKind, PatKind, UnOp};
use rustc_session::declare_tool_lint;
use syntax::ast::LitKind;

Expand Down
4 changes: 3 additions & 1 deletion clippy_lints/src/assign_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,9 @@ fn lint_misrefactored_assign_op(

#[must_use]
fn is_commutative(op: hir::BinOpKind) -> bool {
use rustc_hir::BinOpKind::*;
use rustc_hir::BinOpKind::{
Add, And, BitAnd, BitOr, BitXor, Div, Eq, Ge, Gt, Le, Lt, Mul, Ne, Or, Rem, Shl, Shr, Sub,
};
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/atomic_ordering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use rustc::declare_lint_pass;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::ty;
use rustc_hir::def_id::DefId;
use rustc_hir::*;
use rustc_hir::{Expr, ExprKind};
use rustc_session::declare_tool_lint;

declare_clippy_lint! {
Expand Down
6 changes: 4 additions & 2 deletions clippy_lints/src/attrs.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! checks for attributes
use crate::reexport::*;
use crate::reexport::Name;
use crate::utils::{
is_present_in_source, last_line_of_span, match_def_path, paths, snippet_opt, span_lint, span_lint_and_sugg,
span_lint_and_then, without_block_comments,
Expand All @@ -13,7 +13,9 @@ use rustc::lint::{
};
use rustc::ty;
use rustc_errors::Applicability;
use rustc_hir::*;
use rustc_hir::{
Block, Expr, ExprKind, ImplItem, ImplItemKind, Item, ItemKind, StmtKind, TraitItem, TraitItemKind, TraitMethod,
};
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 @@ -5,7 +5,7 @@ use if_chain::if_chain;
use rustc::impl_lint_pass;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc_errors::Applicability;
use rustc_hir::*;
use rustc_hir::{BinOpKind, Expr, ExprKind};
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
Expand Up @@ -2,7 +2,7 @@ use crate::utils::span_lint;
use rustc::impl_lint_pass;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc_data_structures::fx::FxHashSet;
use rustc_hir::*;
use rustc_hir::{Pat, PatKind};
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
@@ -1,10 +1,10 @@
use crate::utils::*;
use crate::utils::{differing_macro_contexts, higher, snippet_block, span_help_and_lint, span_lint};
use matches::matches;
use rustc::declare_lint_pass;
use rustc::hir::map::Map;
use rustc::lint::{in_external_macro, LateContext, LateLintPass, LintArray, LintContext, LintPass};
use rustc_hir::intravisit::{walk_expr, NestedVisitorMap, Visitor};
use rustc_hir::*;
use rustc_hir::{BlockCheckMode, Expr, ExprKind};
use rustc_session::declare_tool_lint;

declare_clippy_lint! {
Expand Down
10 changes: 5 additions & 5 deletions clippy_lints/src/booleans.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ use rustc::hir::map::Map;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc_errors::Applicability;
use rustc_hir::intravisit;
use rustc_hir::intravisit::*;
use rustc_hir::*;
use rustc_hir::intravisit::{walk_expr, NestedVisitorMap, Visitor};
use rustc_hir::{BinOpKind, Body, Expr, ExprKind, FnDecl, HirId, UnOp};
use rustc_session::declare_tool_lint;
use rustc_span::source_map::Span;
use syntax::ast::LitKind;
Expand Down Expand Up @@ -163,7 +163,7 @@ struct SuggestContext<'a, 'tcx, 'v> {

impl<'a, 'tcx, 'v> SuggestContext<'a, 'tcx, 'v> {
fn recurse(&mut self, suggestion: &Bool) -> Option<()> {
use quine_mc_cluskey::Bool::*;
use quine_mc_cluskey::Bool::{And, False, Not, Or, Term, True};
match suggestion {
True => {
self.output.push_str("true");
Expand Down Expand Up @@ -279,7 +279,7 @@ fn suggest(cx: &LateContext<'_, '_>, suggestion: &Bool, terminals: &[&Expr<'_>])
}

fn simple_negate(b: Bool) -> Bool {
use quine_mc_cluskey::Bool::*;
use quine_mc_cluskey::Bool::{And, False, Not, Or, Term, True};
match b {
True => False,
False => True,
Expand Down Expand Up @@ -327,7 +327,7 @@ fn terminal_stats(b: &Bool) -> Stats {
&Term(n) => stats.terminals[n as usize] += 1,
}
}
use quine_mc_cluskey::Bool::*;
use quine_mc_cluskey::Bool::{And, False, Not, Or, Term, True};
let mut stats = Stats::default();
recurse(b, &mut stats);
stats
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 @@ -7,7 +7,7 @@ use rustc::declare_lint_pass;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::ty;
use rustc_errors::Applicability;
use rustc_hir::*;
use rustc_hir::{BinOpKind, BorrowKind, Expr, ExprKind, UnOp};
use rustc_session::declare_tool_lint;
use syntax::ast::{Name, UintTy};

Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/cargo_common_metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use rustc::declare_lint_pass;
use rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass};
use rustc_session::declare_tool_lint;
use rustc_span::source_map::DUMMY_SP;
use syntax::ast::*;
use syntax::ast::Crate;

declare_clippy_lint! {
/// **What it does:** Checks to see if all common metadata is defined in
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 @@ -4,7 +4,7 @@ use if_chain::if_chain;
use rustc::declare_lint_pass;
use rustc::lint::{in_external_macro, LateContext, LateLintPass, LintArray, LintContext, LintPass};
use rustc_errors::Applicability;
use rustc_hir::*;
use rustc_hir::{BinOp, BinOpKind, Expr, ExprKind, QPath, TyKind};
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
Expand Up @@ -4,7 +4,7 @@ use rustc::hir::map::Map;
use rustc::impl_lint_pass;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintContext, LintPass};
use rustc_hir::intravisit::{walk_expr, FnKind, NestedVisitorMap, Visitor};
use rustc_hir::*;
use rustc_hir::{Body, Expr, ExprKind, FnDecl, HirId};
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 @@ -3,7 +3,7 @@ use crate::utils::{
};
use rustc::declare_lint_pass;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc_hir::*;
use rustc_hir::{BinOpKind, Expr, ExprKind};
use rustc_session::declare_tool_lint;

declare_clippy_lint! {
Expand Down
10 changes: 4 additions & 6 deletions clippy_lints/src/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ 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_hir::{BinOp, BinOpKind, Block, Expr, ExprKind, HirId, QPath, UnOp};
use rustc_span::symbol::Symbol;
use std::cmp::Ordering::{self, Equal};
use std::cmp::PartialOrd;
use std::convert::TryInto;
use std::hash::{Hash, Hasher};
use syntax::ast::{FloatTy, LitKind};
use syntax::ast::{FloatTy, LitFloatType, LitKind};

/// A `LitKind`-like enum to fold constant `Expr`s into.
#[derive(Debug, Clone)]
Expand Down Expand Up @@ -153,8 +153,6 @@ impl Constant {

/// Parses a `LitKind` to a `Constant`.
pub fn lit_to_constant(lit: &LitKind, ty: Option<Ty<'_>>) -> Constant {
use syntax::ast::*;

match *lit {
LitKind::Str(ref is, _) => Constant::Str(is.to_string()),
LitKind::Byte(b) => Constant::Int(u128::from(b)),
Expand Down Expand Up @@ -278,7 +276,7 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> {

#[allow(clippy::cast_possible_wrap)]
fn constant_not(&self, o: &Constant, ty: Ty<'_>) -> Option<Constant> {
use self::Constant::*;
use self::Constant::{Bool, Int};
match *o {
Bool(b) => Some(Bool(!b)),
Int(value) => {
Expand All @@ -294,7 +292,7 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> {
}

fn constant_negate(&self, o: &Constant, ty: Ty<'_>) -> Option<Constant> {
use self::Constant::*;
use self::Constant::{Int, F32, F64};
match *o {
Int(value) => {
let ity = match ty.kind {
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/copies.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use rustc::declare_lint_pass;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::ty::Ty;
use rustc_data_structures::fx::FxHashMap;
use rustc_hir::*;
use rustc_hir::{Arm, Block, Expr, ExprKind, MatchSource, Pat, PatKind};
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/default_trait_access.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use rustc::declare_lint_pass;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::ty;
use rustc_errors::Applicability;
use rustc_hir::*;
use rustc_hir::{Expr, ExprKind, QPath};
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 @@ -4,7 +4,7 @@ use if_chain::if_chain;
use rustc::declare_lint_pass;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::ty::{self, Ty};
use rustc_hir::*;
use rustc_hir::{Item, ItemKind, TraitRef};
use rustc_session::declare_tool_lint;
use rustc_span::source_map::Span;

Expand Down
8 changes: 5 additions & 3 deletions clippy_lints/src/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ fn check_attrs<'a>(cx: &LateContext<'_, '_>, valid_idents: &FxHashSet<String>, a
let parser = pulldown_cmark::Parser::new(&doc).into_offset_iter();
// Iterate over all `Events` and combine consecutive events into one
let events = parser.coalesce(|previous, current| {
use pulldown_cmark::Event::*;
use pulldown_cmark::Event::Text;

let previous_range = previous.1;
let current_range = current.1;
Expand All @@ -343,8 +343,10 @@ fn check_doc<'a, Events: Iterator<Item = (pulldown_cmark::Event<'a>, Range<usize
spans: &[(usize, Span)],
) -> DocHeaders {
// true if a safety header was found
use pulldown_cmark::Event::*;
use pulldown_cmark::Tag::*;
use pulldown_cmark::Event::{
Code, End, FootnoteReference, HardBreak, Html, Rule, SoftBreak, Start, TaskListMarker, Text,
};
use pulldown_cmark::Tag::{CodeBlock, Heading, Link};

let mut headers = DocHeaders {
safety: false,
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/double_comparison.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use rustc::declare_lint_pass;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc_errors::Applicability;
use rustc_hir::*;
use rustc_hir::{BinOpKind, Expr, ExprKind};
use rustc_session::declare_tool_lint;
use rustc_span::source_map::Span;

Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/double_parens.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::utils::span_lint;
use rustc::declare_lint_pass;
use rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass};
use rustc_session::declare_tool_lint;
use syntax::ast::*;
use syntax::ast::{Expr, ExprKind};

declare_clippy_lint! {
/// **What it does:** Checks for unnecessary double parentheses.
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/drop_bounds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::utils::{match_def_path, paths, span_lint};
use if_chain::if_chain;
use rustc::declare_lint_pass;
use rustc::lint::{LateLintPass, LintArray, LintPass};
use rustc_hir::*;
use rustc_hir::{GenericBound, GenericParam, WhereBoundPredicate, WherePredicate};
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
Expand Up @@ -3,7 +3,7 @@ use if_chain::if_chain;
use rustc::declare_lint_pass;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::ty;
use rustc_hir::*;
use rustc_hir::{Expr, ExprKind};
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
Expand Up @@ -2,7 +2,7 @@ use if_chain::if_chain;
use rustc::declare_lint_pass;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc_errors::Applicability;
use rustc_hir::*;
use rustc_hir::{BinOpKind, Expr, ExprKind};
use rustc_session::declare_tool_lint;
use rustc_span::source_map::Spanned;

Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/else_if_without_else.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use rustc::declare_lint_pass;
use rustc::lint::{in_external_macro, EarlyContext, EarlyLintPass, LintArray, LintContext, LintPass};
use rustc_session::declare_tool_lint;
use syntax::ast::*;
use syntax::ast::{Expr, ExprKind};

use crate::utils::span_help_and_lint;

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 @@ -3,7 +3,7 @@
use crate::utils::span_lint_and_then;
use rustc::declare_lint_pass;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc_hir::*;
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/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use rustc::hir::map::Map;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc_errors::Applicability;
use rustc_hir::intravisit::{walk_expr, NestedVisitorMap, Visitor};
use rustc_hir::*;
use rustc_hir::{BorrowKind, Expr, ExprKind, UnOp};
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 @@ -7,7 +7,7 @@ use rustc::declare_lint_pass;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::ty;
use rustc::ty::util::IntTypeExt;
use rustc_hir::*;
use rustc_hir::{Item, ItemKind};
use rustc_session::declare_tool_lint;
use std::convert::TryFrom;
use syntax::ast::{IntTy, UintTy};
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/enum_glob_use.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::utils::span_lint;
use rustc::declare_lint_pass;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc_hir::def::{DefKind, Res};
use rustc_hir::*;
use rustc_hir::{HirId, Item, ItemKind, Mod, UseKind};
use rustc_session::declare_tool_lint;
use rustc_span::source_map::Span;

Expand Down
Loading

0 comments on commit 7e834c8

Please sign in to comment.