From 8472ecda0f18a2b1045d4b8736e06e774ab1c73a Mon Sep 17 00:00:00 2001 From: flip1995 Date: Fri, 21 Feb 2020 09:39:38 +0100 Subject: [PATCH] Fix fallout --- clippy_dev/src/main.rs | 5 ++++- clippy_lints/src/approx_const.rs | 2 +- clippy_lints/src/as_conversions.rs | 2 +- clippy_lints/src/assertions_on_constants.rs | 2 +- clippy_lints/src/assign_ops.rs | 4 +++- clippy_lints/src/atomic_ordering.rs | 2 +- clippy_lints/src/attrs.rs | 6 +++-- clippy_lints/src/bit_mask.rs | 2 +- clippy_lints/src/blacklisted_name.rs | 2 +- clippy_lints/src/block_in_if_condition.rs | 4 ++-- clippy_lints/src/booleans.rs | 10 ++++----- clippy_lints/src/bytecount.rs | 2 +- clippy_lints/src/cargo_common_metadata.rs | 2 +- clippy_lints/src/checked_conversions.rs | 2 +- clippy_lints/src/cognitive_complexity.rs | 2 +- clippy_lints/src/comparison_chain.rs | 2 +- clippy_lints/src/consts.rs | 10 ++++----- clippy_lints/src/copies.rs | 2 +- clippy_lints/src/default_trait_access.rs | 2 +- clippy_lints/src/derive.rs | 2 +- clippy_lints/src/doc.rs | 8 ++++--- clippy_lints/src/double_comparison.rs | 2 +- clippy_lints/src/double_parens.rs | 2 +- clippy_lints/src/drop_bounds.rs | 2 +- clippy_lints/src/drop_forget_ref.rs | 2 +- clippy_lints/src/duration_subsec.rs | 2 +- clippy_lints/src/else_if_without_else.rs | 2 +- clippy_lints/src/empty_enum.rs | 2 +- clippy_lints/src/entry.rs | 2 +- clippy_lints/src/enum_clike.rs | 2 +- clippy_lints/src/enum_variants.rs | 2 +- clippy_lints/src/eq_op.rs | 2 +- clippy_lints/src/erasing_op.rs | 2 +- clippy_lints/src/escape.rs | 4 ++-- clippy_lints/src/eta_reduction.rs | 2 +- clippy_lints/src/eval_order_dependence.rs | 2 +- clippy_lints/src/explicit_write.rs | 2 +- clippy_lints/src/fallible_impl_from.rs | 2 +- clippy_lints/src/float_literal.rs | 2 +- clippy_lints/src/format.rs | 2 +- clippy_lints/src/formatting.rs | 2 +- clippy_lints/src/functions.rs | 6 ++--- clippy_lints/src/identity_conversion.rs | 2 +- clippy_lints/src/identity_op.rs | 2 +- clippy_lints/src/if_let_some_result.rs | 2 +- clippy_lints/src/if_not_else.rs | 2 +- clippy_lints/src/indexing_slicing.rs | 2 +- clippy_lints/src/infinite_iter.rs | 2 +- clippy_lints/src/inherent_impl.rs | 2 +- clippy_lints/src/inline_fn_without_body.rs | 2 +- clippy_lints/src/int_plus_one.rs | 2 +- clippy_lints/src/items_after_statements.rs | 2 +- clippy_lints/src/large_enum_variant.rs | 2 +- clippy_lints/src/large_stack_arrays.rs | 2 +- clippy_lints/src/len_zero.rs | 2 +- clippy_lints/src/let_underscore.rs | 2 +- clippy_lints/src/lifetimes.rs | 12 +++++++--- clippy_lints/src/literal_representation.rs | 2 +- clippy_lints/src/loops.rs | 9 +++++--- clippy_lints/src/matches.rs | 5 ++++- .../methods/manual_saturating_arithmetic.rs | 5 ++++- .../src/methods/option_map_unwrap_or.rs | 2 +- clippy_lints/src/minmax.rs | 2 +- clippy_lints/src/misc.rs | 5 ++++- clippy_lints/src/misc_early.rs | 5 ++++- clippy_lints/src/modulo_arithmetic.rs | 2 +- clippy_lints/src/mul_add.rs | 4 ++-- clippy_lints/src/multiple_crate_versions.rs | 2 +- clippy_lints/src/mut_reference.rs | 2 +- clippy_lints/src/needless_bool.rs | 6 ++--- clippy_lints/src/needless_pass_by_value.rs | 2 +- clippy_lints/src/neg_cmp_op_on_partial_ord.rs | 2 +- clippy_lints/src/neg_multiply.rs | 2 +- clippy_lints/src/non_copy_const.rs | 2 +- clippy_lints/src/non_expressive_names.rs | 4 +++- clippy_lints/src/option_env_unwrap.rs | 2 +- .../src/overflow_check_conditional.rs | 2 +- clippy_lints/src/panic_unimplemented.rs | 2 +- clippy_lints/src/partialeq_ne_impl.rs | 2 +- clippy_lints/src/path_buf_push_overwrite.rs | 2 +- clippy_lints/src/precedence.rs | 6 ++--- clippy_lints/src/ptr.rs | 5 ++++- clippy_lints/src/question_mark.rs | 4 ++-- clippy_lints/src/ranges.rs | 2 +- clippy_lints/src/redundant_clone.rs | 2 +- clippy_lints/src/redundant_field_names.rs | 2 +- .../src/redundant_pattern_matching.rs | 2 +- .../src/redundant_static_lifetimes.rs | 2 +- clippy_lints/src/regex.rs | 6 ++--- clippy_lints/src/replace_consts.rs | 2 +- clippy_lints/src/serde_api.rs | 2 +- clippy_lints/src/shadow.rs | 7 ++++-- .../src/slow_vector_initialization.rs | 2 +- clippy_lints/src/strings.rs | 2 +- clippy_lints/src/swap.rs | 2 +- clippy_lints/src/trait_bounds.rs | 2 +- clippy_lints/src/transmute.rs | 2 +- .../src/trivially_copy_pass_by_ref.rs | 2 +- clippy_lints/src/try_err.rs | 2 +- clippy_lints/src/types.rs | 22 +++++++++++-------- clippy_lints/src/unicode.rs | 2 +- clippy_lints/src/unsafe_removed_from_name.rs | 2 +- clippy_lints/src/unwrap.rs | 4 ++-- clippy_lints/src/use_self.rs | 5 ++++- clippy_lints/src/utils/author.rs | 2 +- clippy_lints/src/utils/hir_utils.rs | 6 ++++- clippy_lints/src/utils/internal_lints.rs | 2 +- clippy_lints/src/utils/mod.rs | 9 +++++--- clippy_lints/src/utils/ptr.rs | 2 +- clippy_lints/src/utils/sugg.rs | 11 +++++++--- clippy_lints/src/utils/usage.rs | 4 ++-- clippy_lints/src/vec.rs | 2 +- clippy_lints/src/wildcard_dependencies.rs | 2 +- clippy_lints/src/write.rs | 6 +++-- clippy_lints/src/zero_div_zero.rs | 2 +- src/driver.rs | 4 ++-- src/main.rs | 2 +- 117 files changed, 219 insertions(+), 162 deletions(-) diff --git a/clippy_dev/src/main.rs b/clippy_dev/src/main.rs index ec0c33109..901e663de 100644 --- a/clippy_dev/src/main.rs +++ b/clippy_dev/src/main.rs @@ -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, DOCS_LINK, +}; use std::path::Path; mod fmt; diff --git a/clippy_lints/src/approx_const.rs b/clippy_lints/src/approx_const.rs index 51b6f2f06..042b83dc3 100644 --- a/clippy_lints/src/approx_const.rs +++ b/clippy_lints/src/approx_const.rs @@ -1,5 +1,5 @@ use crate::utils::span_lint; -use rustc_hir::*; +use rustc_hir::{Expr, ExprKind}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::symbol; diff --git a/clippy_lints/src/as_conversions.rs b/clippy_lints/src/as_conversions.rs index d90a0d67d..5c584b18f 100644 --- a/clippy_lints/src/as_conversions.rs +++ b/clippy_lints/src/as_conversions.rs @@ -1,7 +1,7 @@ use rustc::lint::in_external_macro; use rustc_lint::{EarlyContext, EarlyLintPass, LintContext}; use rustc_session::{declare_lint_pass, declare_tool_lint}; -use syntax::ast::*; +use syntax::ast::{Expr, ExprKind}; use crate::utils::span_lint_and_help; diff --git a/clippy_lints/src/assertions_on_constants.rs b/clippy_lints/src/assertions_on_constants.rs index e399229b4..8a7a48aeb 100644 --- a/clippy_lints/src/assertions_on_constants.rs +++ b/clippy_lints/src/assertions_on_constants.rs @@ -2,7 +2,7 @@ use crate::consts::{constant, Constant}; use crate::utils::paths; use crate::utils::{is_direct_expn_of, is_expn_of, match_function_call, snippet_opt, span_lint_and_help}; use if_chain::if_chain; -use rustc_hir::*; +use rustc_hir::{Expr, ExprKind, PatKind, UnOp}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use syntax::ast::LitKind; diff --git a/clippy_lints/src/assign_ops.rs b/clippy_lints/src/assign_ops.rs index 7ad0ce232..bc4e47340 100644 --- a/clippy_lints/src/assign_ops.rs +++ b/clippy_lints/src/assign_ops.rs @@ -231,7 +231,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, diff --git a/clippy_lints/src/atomic_ordering.rs b/clippy_lints/src/atomic_ordering.rs index 178ee4529..871ca029b 100644 --- a/clippy_lints/src/atomic_ordering.rs +++ b/clippy_lints/src/atomic_ordering.rs @@ -2,7 +2,7 @@ use crate::utils::{match_def_path, span_lint_and_help}; use if_chain::if_chain; use rustc::ty; use rustc_hir::def_id::DefId; -use rustc_hir::*; +use rustc_hir::{Expr, ExprKind}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; diff --git a/clippy_lints/src/attrs.rs b/clippy_lints/src/attrs.rs index 6f67acb29..5c083cefc 100644 --- a/clippy_lints/src/attrs.rs +++ b/clippy_lints/src/attrs.rs @@ -1,6 +1,6 @@ //! checks for attributes -use crate::reexport::*; +use crate::reexport::Name; use crate::utils::{ first_line_of_span, is_present_in_source, match_def_path, paths, snippet_opt, span_lint, span_lint_and_sugg, span_lint_and_then, without_block_comments, @@ -9,7 +9,9 @@ use if_chain::if_chain; use rustc::lint::in_external_macro; 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_lint::{CheckLintNameResult, EarlyContext, EarlyLintPass, LateContext, LateLintPass, LintContext}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::source_map::Span; diff --git a/clippy_lints/src/bit_mask.rs b/clippy_lints/src/bit_mask.rs index 926b1c63a..05f85e929 100644 --- a/clippy_lints/src/bit_mask.rs +++ b/clippy_lints/src/bit_mask.rs @@ -3,7 +3,7 @@ use crate::utils::sugg::Sugg; use crate::utils::{span_lint, span_lint_and_then}; use if_chain::if_chain; use rustc_errors::Applicability; -use rustc_hir::*; +use rustc_hir::{BinOpKind, Expr, ExprKind}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_tool_lint, impl_lint_pass}; use rustc_span::source_map::Span; diff --git a/clippy_lints/src/blacklisted_name.rs b/clippy_lints/src/blacklisted_name.rs index cb68ba598..6f26f0314 100644 --- a/clippy_lints/src/blacklisted_name.rs +++ b/clippy_lints/src/blacklisted_name.rs @@ -1,6 +1,6 @@ use crate::utils::span_lint; use rustc_data_structures::fx::FxHashSet; -use rustc_hir::*; +use rustc_hir::{Pat, PatKind}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_tool_lint, impl_lint_pass}; diff --git a/clippy_lints/src/block_in_if_condition.rs b/clippy_lints/src/block_in_if_condition.rs index 325e12617..d004dcddf 100644 --- a/clippy_lints/src/block_in_if_condition.rs +++ b/clippy_lints/src/block_in_if_condition.rs @@ -1,10 +1,10 @@ -use crate::utils::*; +use crate::utils::{differing_macro_contexts, higher, snippet_block_with_applicability, span_lint, span_lint_and_sugg}; use matches::matches; use rustc::hir::map::Map; use rustc::lint::in_external_macro; use rustc_errors::Applicability; use rustc_hir::intravisit::{walk_expr, NestedVisitorMap, Visitor}; -use rustc_hir::*; +use rustc_hir::{BlockCheckMode, Expr, ExprKind}; use rustc_lint::{LateContext, LateLintPass, LintContext}; use rustc_session::{declare_lint_pass, declare_tool_lint}; diff --git a/clippy_lints/src/booleans.rs b/clippy_lints/src/booleans.rs index d37f77cf6..07b4f572d 100644 --- a/clippy_lints/src/booleans.rs +++ b/clippy_lints/src/booleans.rs @@ -5,8 +5,8 @@ use crate::utils::{ use if_chain::if_chain; use rustc::hir::map::Map; use rustc_errors::Applicability; -use rustc_hir::intravisit::*; -use rustc_hir::*; +use rustc_hir::intravisit::{walk_expr, FnKind, NestedVisitorMap, Visitor}; +use rustc_hir::{BinOpKind, Body, Expr, ExprKind, FnDecl, HirId, UnOp}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::source_map::Span; @@ -161,7 +161,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"); @@ -277,7 +277,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, @@ -325,7 +325,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 diff --git a/clippy_lints/src/bytecount.rs b/clippy_lints/src/bytecount.rs index 2adc3b429..e8168cb73 100644 --- a/clippy_lints/src/bytecount.rs +++ b/clippy_lints/src/bytecount.rs @@ -5,7 +5,7 @@ use crate::utils::{ use if_chain::if_chain; use rustc::ty; use rustc_errors::Applicability; -use rustc_hir::*; +use rustc_hir::{BinOpKind, BorrowKind, Expr, ExprKind, UnOp}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use syntax::ast::{Name, UintTy}; diff --git a/clippy_lints/src/cargo_common_metadata.rs b/clippy_lints/src/cargo_common_metadata.rs index ec53e08f5..9e0e9d7dd 100644 --- a/clippy_lints/src/cargo_common_metadata.rs +++ b/clippy_lints/src/cargo_common_metadata.rs @@ -6,7 +6,7 @@ use crate::utils::span_lint; use rustc_lint::{EarlyContext, EarlyLintPass}; use rustc_session::{declare_lint_pass, 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 diff --git a/clippy_lints/src/checked_conversions.rs b/clippy_lints/src/checked_conversions.rs index 88df0772a..835f8b7f9 100644 --- a/clippy_lints/src/checked_conversions.rs +++ b/clippy_lints/src/checked_conversions.rs @@ -3,7 +3,7 @@ use if_chain::if_chain; use rustc::lint::in_external_macro; use rustc_errors::Applicability; -use rustc_hir::*; +use rustc_hir::{BinOp, BinOpKind, Expr, ExprKind, QPath, TyKind}; use rustc_lint::{LateContext, LateLintPass, LintContext}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use syntax::ast::LitKind; diff --git a/clippy_lints/src/cognitive_complexity.rs b/clippy_lints/src/cognitive_complexity.rs index 2b6315255..ecae13a49 100644 --- a/clippy_lints/src/cognitive_complexity.rs +++ b/clippy_lints/src/cognitive_complexity.rs @@ -2,7 +2,7 @@ use rustc::hir::map::Map; use rustc_hir::intravisit::{walk_expr, FnKind, NestedVisitorMap, Visitor}; -use rustc_hir::*; +use rustc_hir::{Body, Expr, ExprKind, FnDecl, HirId}; use rustc_lint::{LateContext, LateLintPass, LintContext}; use rustc_session::{declare_tool_lint, impl_lint_pass}; use rustc_span::source_map::Span; diff --git a/clippy_lints/src/comparison_chain.rs b/clippy_lints/src/comparison_chain.rs index 684d3448e..e0c381ddb 100644 --- a/clippy_lints/src/comparison_chain.rs +++ b/clippy_lints/src/comparison_chain.rs @@ -1,7 +1,7 @@ use crate::utils::{ get_trait_def_id, if_sequence, implements_trait, parent_node_is_if_expr, paths, span_lint_and_help, SpanlessEq, }; -use rustc_hir::*; +use rustc_hir::{BinOpKind, Expr, ExprKind}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; diff --git a/clippy_lints/src/consts.rs b/clippy_lints/src/consts.rs index 7efc62d4c..edfd2486b 100644 --- a/clippy_lints/src/consts.rs +++ b/clippy_lints/src/consts.rs @@ -7,13 +7,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_lint::LateContext; use rustc_span::symbol::Symbol; use std::cmp::Ordering::{self, Equal}; 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)] @@ -152,8 +152,6 @@ impl Constant { /// Parses a `LitKind` to a `Constant`. pub fn lit_to_constant(lit: &LitKind, ty: Option>) -> Constant { - use syntax::ast::*; - match *lit { LitKind::Str(ref is, _) => Constant::Str(is.to_string()), LitKind::Byte(b) => Constant::Int(u128::from(b)), @@ -277,7 +275,7 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> { #[allow(clippy::cast_possible_wrap)] fn constant_not(&self, o: &Constant, ty: Ty<'_>) -> Option { - use self::Constant::*; + use self::Constant::{Bool, Int}; match *o { Bool(b) => Some(Bool(!b)), Int(value) => { @@ -293,7 +291,7 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> { } fn constant_negate(&self, o: &Constant, ty: Ty<'_>) -> Option { - use self::Constant::*; + use self::Constant::{Int, F32, F64}; match *o { Int(value) => { let ity = match ty.kind { diff --git a/clippy_lints/src/copies.rs b/clippy_lints/src/copies.rs index d2d20375d..996f80a75 100644 --- a/clippy_lints/src/copies.rs +++ b/clippy_lints/src/copies.rs @@ -2,7 +2,7 @@ use crate::utils::{get_parent_expr, higher, if_sequence, same_tys, snippet, span use crate::utils::{SpanlessEq, SpanlessHash}; 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_lint::{LateContext, LateLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::symbol::Symbol; diff --git a/clippy_lints/src/default_trait_access.rs b/clippy_lints/src/default_trait_access.rs index 0e1380df9..f99e6d96e 100644 --- a/clippy_lints/src/default_trait_access.rs +++ b/clippy_lints/src/default_trait_access.rs @@ -1,7 +1,7 @@ use if_chain::if_chain; use rustc::ty; use rustc_errors::Applicability; -use rustc_hir::*; +use rustc_hir::{Expr, ExprKind, QPath}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; diff --git a/clippy_lints/src/derive.rs b/clippy_lints/src/derive.rs index efb44ab6d..f130a6977 100644 --- a/clippy_lints/src/derive.rs +++ b/clippy_lints/src/derive.rs @@ -2,7 +2,7 @@ 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::ty::{self, Ty}; -use rustc_hir::*; +use rustc_hir::{Item, ItemKind, TraitRef}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::source_map::Span; diff --git a/clippy_lints/src/doc.rs b/clippy_lints/src/doc.rs index 9b8664c13..be65fd21a 100644 --- a/clippy_lints/src/doc.rs +++ b/clippy_lints/src/doc.rs @@ -350,7 +350,7 @@ fn check_attrs<'a>(cx: &LateContext<'_, '_>, valid_idents: &FxHashSet, 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; @@ -374,8 +374,10 @@ fn check_doc<'a, Events: Iterator, Range 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, diff --git a/clippy_lints/src/double_comparison.rs b/clippy_lints/src/double_comparison.rs index 934e3ccdf..44f85d1ea 100644 --- a/clippy_lints/src/double_comparison.rs +++ b/clippy_lints/src/double_comparison.rs @@ -1,7 +1,7 @@ //! Lint on unnecessary double comparisons. Some examples: use rustc_errors::Applicability; -use rustc_hir::*; +use rustc_hir::{BinOpKind, Expr, ExprKind}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::source_map::Span; diff --git a/clippy_lints/src/double_parens.rs b/clippy_lints/src/double_parens.rs index d08981e8b..c4c4758eb 100644 --- a/clippy_lints/src/double_parens.rs +++ b/clippy_lints/src/double_parens.rs @@ -1,7 +1,7 @@ use crate::utils::span_lint; use rustc_lint::{EarlyContext, EarlyLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; -use syntax::ast::*; +use syntax::ast::{Expr, ExprKind}; declare_clippy_lint! { /// **What it does:** Checks for unnecessary double parentheses. diff --git a/clippy_lints/src/drop_bounds.rs b/clippy_lints/src/drop_bounds.rs index 1d445a153..f49668082 100644 --- a/clippy_lints/src/drop_bounds.rs +++ b/clippy_lints/src/drop_bounds.rs @@ -1,6 +1,6 @@ use crate::utils::{match_def_path, paths, span_lint}; use if_chain::if_chain; -use rustc_hir::*; +use rustc_hir::{GenericBound, GenericParam, WhereBoundPredicate, WherePredicate}; use rustc_lint::LateLintPass; use rustc_session::{declare_lint_pass, declare_tool_lint}; diff --git a/clippy_lints/src/drop_forget_ref.rs b/clippy_lints/src/drop_forget_ref.rs index 29351deea..bd9bdfef0 100644 --- a/clippy_lints/src/drop_forget_ref.rs +++ b/clippy_lints/src/drop_forget_ref.rs @@ -1,7 +1,7 @@ use crate::utils::{is_copy, match_def_path, paths, qpath_res, span_lint_and_note}; use if_chain::if_chain; use rustc::ty; -use rustc_hir::*; +use rustc_hir::{Expr, ExprKind}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; diff --git a/clippy_lints/src/duration_subsec.rs b/clippy_lints/src/duration_subsec.rs index 366996fb3..b35a8facf 100644 --- a/clippy_lints/src/duration_subsec.rs +++ b/clippy_lints/src/duration_subsec.rs @@ -1,6 +1,6 @@ use if_chain::if_chain; use rustc_errors::Applicability; -use rustc_hir::*; +use rustc_hir::{BinOpKind, Expr, ExprKind}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::source_map::Spanned; diff --git a/clippy_lints/src/else_if_without_else.rs b/clippy_lints/src/else_if_without_else.rs index b87900180..c41c5aadb 100644 --- a/clippy_lints/src/else_if_without_else.rs +++ b/clippy_lints/src/else_if_without_else.rs @@ -3,7 +3,7 @@ use rustc::lint::in_external_macro; use rustc_lint::{EarlyContext, EarlyLintPass, LintContext}; use rustc_session::{declare_lint_pass, declare_tool_lint}; -use syntax::ast::*; +use syntax::ast::{Expr, ExprKind}; use crate::utils::span_lint_and_help; diff --git a/clippy_lints/src/empty_enum.rs b/clippy_lints/src/empty_enum.rs index c43db68d2..010d208c9 100644 --- a/clippy_lints/src/empty_enum.rs +++ b/clippy_lints/src/empty_enum.rs @@ -1,7 +1,7 @@ //! lint when there is an enum with no variants use crate::utils::span_lint_and_then; -use rustc_hir::*; +use rustc_hir::{Item, ItemKind}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; diff --git a/clippy_lints/src/entry.rs b/clippy_lints/src/entry.rs index d32e78798..19da4c4bc 100644 --- a/clippy_lints/src/entry.rs +++ b/clippy_lints/src/entry.rs @@ -5,7 +5,7 @@ use if_chain::if_chain; use rustc::hir::map::Map; use rustc_errors::Applicability; use rustc_hir::intravisit::{walk_expr, NestedVisitorMap, Visitor}; -use rustc_hir::*; +use rustc_hir::{BorrowKind, Expr, ExprKind, UnOp}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::source_map::Span; diff --git a/clippy_lints/src/enum_clike.rs b/clippy_lints/src/enum_clike.rs index 2e14956ec..e8063ac30 100644 --- a/clippy_lints/src/enum_clike.rs +++ b/clippy_lints/src/enum_clike.rs @@ -5,7 +5,7 @@ use crate::consts::{miri_to_const, Constant}; use crate::utils::span_lint; use rustc::ty; use rustc::ty::util::IntTypeExt; -use rustc_hir::*; +use rustc_hir::{Item, ItemKind}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use std::convert::TryFrom; diff --git a/clippy_lints/src/enum_variants.rs b/clippy_lints/src/enum_variants.rs index 75205f964..0d14b8a75 100644 --- a/clippy_lints/src/enum_variants.rs +++ b/clippy_lints/src/enum_variants.rs @@ -6,7 +6,7 @@ use rustc_lint::{EarlyContext, EarlyLintPass, Lint}; use rustc_session::{declare_tool_lint, impl_lint_pass}; use rustc_span::source_map::Span; use rustc_span::symbol::Symbol; -use syntax::ast::*; +use syntax::ast::{EnumDef, Item, ItemKind, VisibilityKind}; declare_clippy_lint! { /// **What it does:** Detects enumeration variants that are prefixed or suffixed diff --git a/clippy_lints/src/eq_op.rs b/clippy_lints/src/eq_op.rs index 01b04220a..1df0bcc6b 100644 --- a/clippy_lints/src/eq_op.rs +++ b/clippy_lints/src/eq_op.rs @@ -2,7 +2,7 @@ use crate::utils::{ implements_trait, in_macro, is_copy, multispan_sugg, snippet, span_lint, span_lint_and_then, SpanlessEq, }; use rustc_errors::Applicability; -use rustc_hir::*; +use rustc_hir::{BinOp, BinOpKind, BorrowKind, Expr, ExprKind}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; diff --git a/clippy_lints/src/erasing_op.rs b/clippy_lints/src/erasing_op.rs index e08e01c1d..3ff0506e2 100644 --- a/clippy_lints/src/erasing_op.rs +++ b/clippy_lints/src/erasing_op.rs @@ -1,4 +1,4 @@ -use rustc_hir::*; +use rustc_hir::{BinOpKind, Expr, ExprKind}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::source_map::Span; diff --git a/clippy_lints/src/escape.rs b/clippy_lints/src/escape.rs index 73bd7b3a1..850c7f728 100644 --- a/clippy_lints/src/escape.rs +++ b/clippy_lints/src/escape.rs @@ -1,12 +1,12 @@ use rustc::ty::layout::LayoutOf; use rustc::ty::{self, Ty}; use rustc_hir::intravisit; -use rustc_hir::{self, *}; +use rustc_hir::{self, Body, FnDecl, HirId, HirIdSet, ItemKind, Node}; use rustc_infer::infer::TyCtxtInferExt; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_tool_lint, impl_lint_pass}; use rustc_span::source_map::Span; -use rustc_typeck::expr_use_visitor::*; +use rustc_typeck::expr_use_visitor::{ConsumeMode, Delegate, ExprUseVisitor, Place, PlaceBase}; use crate::utils::span_lint; diff --git a/clippy_lints/src/eta_reduction.rs b/clippy_lints/src/eta_reduction.rs index 5ef933845..8c324e09d 100644 --- a/clippy_lints/src/eta_reduction.rs +++ b/clippy_lints/src/eta_reduction.rs @@ -3,7 +3,7 @@ use matches::matches; use rustc::lint::in_external_macro; use rustc::ty::{self, Ty}; use rustc_errors::Applicability; -use rustc_hir::*; +use rustc_hir::{def_id, Expr, ExprKind, Param, PatKind, QPath}; use rustc_lint::{LateContext, LateLintPass, LintContext}; use rustc_session::{declare_lint_pass, declare_tool_lint}; diff --git a/clippy_lints/src/eval_order_dependence.rs b/clippy_lints/src/eval_order_dependence.rs index f143c7462..d6b847d1d 100644 --- a/clippy_lints/src/eval_order_dependence.rs +++ b/clippy_lints/src/eval_order_dependence.rs @@ -3,7 +3,7 @@ use if_chain::if_chain; use rustc::hir::map::Map; use rustc::ty; use rustc_hir::intravisit::{walk_expr, NestedVisitorMap, Visitor}; -use rustc_hir::*; +use rustc_hir::{def, BinOpKind, Block, Expr, ExprKind, Guard, HirId, Local, Node, QPath, Stmt, StmtKind}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; diff --git a/clippy_lints/src/explicit_write.rs b/clippy_lints/src/explicit_write.rs index 4aefa941d..a3005d8bd 100644 --- a/clippy_lints/src/explicit_write.rs +++ b/clippy_lints/src/explicit_write.rs @@ -1,7 +1,7 @@ use crate::utils::{is_expn_of, match_function_call, paths, span_lint, span_lint_and_sugg}; use if_chain::if_chain; use rustc_errors::Applicability; -use rustc_hir::*; +use rustc_hir::{BorrowKind, Expr, ExprKind}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use syntax::ast::LitKind; diff --git a/clippy_lints/src/fallible_impl_from.rs b/clippy_lints/src/fallible_impl_from.rs index 87792b9fb..19a122594 100644 --- a/clippy_lints/src/fallible_impl_from.rs +++ b/clippy_lints/src/fallible_impl_from.rs @@ -48,7 +48,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for FallibleImplFrom { fn lint_impl_body<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, impl_span: Span, impl_items: &[hir::ImplItemRef<'_>]) { use rustc_hir::intravisit::{self, NestedVisitorMap, Visitor}; - use rustc_hir::*; + use rustc_hir::{Expr, ExprKind, ImplItemKind, QPath}; struct FindPanicUnwrap<'a, 'tcx> { lcx: &'a LateContext<'a, 'tcx>, diff --git a/clippy_lints/src/float_literal.rs b/clippy_lints/src/float_literal.rs index 8707259a2..18006f053 100644 --- a/clippy_lints/src/float_literal.rs +++ b/clippy_lints/src/float_literal.rs @@ -7,7 +7,7 @@ use rustc_hir as hir; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use std::{f32, f64, fmt}; -use syntax::ast::*; +use syntax::ast::{FloatTy, LitFloatType, LitKind}; declare_clippy_lint! { /// **What it does:** Checks for float literals with a precision greater diff --git a/clippy_lints/src/format.rs b/clippy_lints/src/format.rs index 36ed7c475..6c80b6525 100644 --- a/clippy_lints/src/format.rs +++ b/clippy_lints/src/format.rs @@ -5,7 +5,7 @@ use crate::utils::{ }; use if_chain::if_chain; use rustc_errors::Applicability; -use rustc_hir::*; +use rustc_hir::{Arm, BorrowKind, Expr, ExprKind, MatchSource, PatKind}; use rustc_lint::{LateContext, LateLintPass, LintContext}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::source_map::Span; diff --git a/clippy_lints/src/formatting.rs b/clippy_lints/src/formatting.rs index 31e924e36..0ab6b1242 100644 --- a/clippy_lints/src/formatting.rs +++ b/clippy_lints/src/formatting.rs @@ -4,7 +4,7 @@ use rustc::lint::in_external_macro; use rustc_lint::{EarlyContext, EarlyLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::source_map::Span; -use syntax::ast::*; +use syntax::ast::{BinOpKind, Block, Expr, ExprKind, StmtKind, UnOp}; declare_clippy_lint! { /// **What it does:** Checks for use of the non-existent `=*`, `=!` and `=-` diff --git a/clippy_lints/src/functions.rs b/clippy_lints/src/functions.rs index ce0bfea51..26b9f2cd6 100644 --- a/clippy_lints/src/functions.rs +++ b/clippy_lints/src/functions.rs @@ -497,7 +497,7 @@ fn is_mutable_pat(cx: &LateContext<'_, '_>, pat: &hir::Pat<'_>, tys: &mut FxHash static KNOWN_WRAPPER_TYS: &[&[&str]] = &[&["alloc", "rc", "Rc"], &["std", "sync", "Arc"]]; fn is_mutable_ty<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, ty: Ty<'tcx>, span: Span, tys: &mut FxHashSet) -> bool { - use ty::TyKind::*; + use ty::TyKind::{Adt, Array, Bool, Char, Float, Int, RawPtr, Ref, Slice, Str, Tuple, Uint}; match ty.kind { // primitive types are never mutable Bool | Char | Int(_) | Uint(_) | Float(_) | Str => false, @@ -593,7 +593,7 @@ impl<'a, 'tcx> intravisit::Visitor<'tcx> for StaticMutVisitor<'a, 'tcx> { type Map = Map<'tcx>; fn visit_expr(&mut self, expr: &'tcx hir::Expr<'_>) { - use hir::ExprKind::*; + use hir::ExprKind::{AddrOf, Assign, AssignOp, Call, MethodCall}; if self.mutates_static { return; @@ -631,7 +631,7 @@ impl<'a, 'tcx> intravisit::Visitor<'tcx> for StaticMutVisitor<'a, 'tcx> { } fn is_mutated_static(cx: &LateContext<'_, '_>, e: &hir::Expr<'_>) -> bool { - use hir::ExprKind::*; + use hir::ExprKind::{Field, Index, Path}; match e.kind { Path(ref qpath) => { diff --git a/clippy_lints/src/identity_conversion.rs b/clippy_lints/src/identity_conversion.rs index 86478f093..3d0734219 100644 --- a/clippy_lints/src/identity_conversion.rs +++ b/clippy_lints/src/identity_conversion.rs @@ -2,7 +2,7 @@ use crate::utils::{ match_def_path, match_trait_method, paths, same_tys, snippet, snippet_with_macro_callsite, span_lint_and_then, }; use rustc_errors::Applicability; -use rustc_hir::*; +use rustc_hir::{Expr, ExprKind, HirId, MatchSource}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_tool_lint, impl_lint_pass}; diff --git a/clippy_lints/src/identity_op.rs b/clippy_lints/src/identity_op.rs index 1896751ff..abd546870 100644 --- a/clippy_lints/src/identity_op.rs +++ b/clippy_lints/src/identity_op.rs @@ -1,5 +1,5 @@ use rustc::ty; -use rustc_hir::*; +use rustc_hir::{BinOpKind, Expr, ExprKind}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::source_map::Span; diff --git a/clippy_lints/src/if_let_some_result.rs b/clippy_lints/src/if_let_some_result.rs index a9826d586..33e2471d5 100644 --- a/clippy_lints/src/if_let_some_result.rs +++ b/clippy_lints/src/if_let_some_result.rs @@ -1,7 +1,7 @@ use crate::utils::{match_type, method_chain_args, paths, snippet_with_applicability, span_lint_and_sugg}; use if_chain::if_chain; use rustc_errors::Applicability; -use rustc_hir::*; +use rustc_hir::{print, Expr, ExprKind, MatchSource, PatKind, QPath}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; diff --git a/clippy_lints/src/if_not_else.rs b/clippy_lints/src/if_not_else.rs index 8deed2142..4689e24f3 100644 --- a/clippy_lints/src/if_not_else.rs +++ b/clippy_lints/src/if_not_else.rs @@ -4,7 +4,7 @@ use rustc::lint::in_external_macro; use rustc_lint::{EarlyContext, EarlyLintPass, LintContext}; use rustc_session::{declare_lint_pass, declare_tool_lint}; -use syntax::ast::*; +use syntax::ast::{BinOpKind, Expr, ExprKind, UnOp}; use crate::utils::span_lint_and_help; diff --git a/clippy_lints/src/indexing_slicing.rs b/clippy_lints/src/indexing_slicing.rs index ac9442e96..f4a7b7985 100644 --- a/clippy_lints/src/indexing_slicing.rs +++ b/clippy_lints/src/indexing_slicing.rs @@ -3,7 +3,7 @@ use crate::consts::{constant, Constant}; use crate::utils::{higher, span_lint, span_lint_and_help}; use rustc::ty; -use rustc_hir::*; +use rustc_hir::{Expr, ExprKind}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use syntax::ast::RangeLimits; diff --git a/clippy_lints/src/infinite_iter.rs b/clippy_lints/src/infinite_iter.rs index cee54488d..cd989c0ea 100644 --- a/clippy_lints/src/infinite_iter.rs +++ b/clippy_lints/src/infinite_iter.rs @@ -1,4 +1,4 @@ -use rustc_hir::*; +use rustc_hir::{BorrowKind, Expr, ExprKind}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; diff --git a/clippy_lints/src/inherent_impl.rs b/clippy_lints/src/inherent_impl.rs index 058ee7265..355e75d0d 100644 --- a/clippy_lints/src/inherent_impl.rs +++ b/clippy_lints/src/inherent_impl.rs @@ -2,7 +2,7 @@ use crate::utils::{in_macro, span_lint_and_then}; use rustc_data_structures::fx::FxHashMap; -use rustc_hir::*; +use rustc_hir::{def_id, Crate, Item, ItemKind}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_tool_lint, impl_lint_pass}; use rustc_span::Span; diff --git a/clippy_lints/src/inline_fn_without_body.rs b/clippy_lints/src/inline_fn_without_body.rs index ed9a958f9..85c61ba23 100644 --- a/clippy_lints/src/inline_fn_without_body.rs +++ b/clippy_lints/src/inline_fn_without_body.rs @@ -3,7 +3,7 @@ use crate::utils::span_lint_and_then; use crate::utils::sugg::DiagnosticBuilderExt; use rustc_errors::Applicability; -use rustc_hir::*; +use rustc_hir::{TraitItem, TraitItemKind, TraitMethod}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use syntax::ast::{Attribute, Name}; diff --git a/clippy_lints/src/int_plus_one.rs b/clippy_lints/src/int_plus_one.rs index cb2d62407..c6734427d 100644 --- a/clippy_lints/src/int_plus_one.rs +++ b/clippy_lints/src/int_plus_one.rs @@ -3,7 +3,7 @@ use rustc_errors::Applicability; use rustc_lint::{EarlyContext, EarlyLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; -use syntax::ast::*; +use syntax::ast::{BinOpKind, Expr, ExprKind, Lit, LitKind}; use crate::utils::{snippet_opt, span_lint_and_then}; diff --git a/clippy_lints/src/items_after_statements.rs b/clippy_lints/src/items_after_statements.rs index 6d944ae8c..13da72539 100644 --- a/clippy_lints/src/items_after_statements.rs +++ b/clippy_lints/src/items_after_statements.rs @@ -4,7 +4,7 @@ use crate::utils::span_lint; use matches::matches; use rustc_lint::{EarlyContext, EarlyLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; -use syntax::ast::*; +use syntax::ast::{Block, ItemKind, StmtKind}; declare_clippy_lint! { /// **What it does:** Checks for items declared after some statement in a block. diff --git a/clippy_lints/src/large_enum_variant.rs b/clippy_lints/src/large_enum_variant.rs index 0cd02f212..39c8c4cfa 100644 --- a/clippy_lints/src/large_enum_variant.rs +++ b/clippy_lints/src/large_enum_variant.rs @@ -3,7 +3,7 @@ use crate::utils::{snippet_opt, span_lint_and_then}; use rustc::ty::layout::LayoutOf; use rustc_errors::Applicability; -use rustc_hir::*; +use rustc_hir::{Item, ItemKind, VariantData}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_tool_lint, impl_lint_pass}; diff --git a/clippy_lints/src/large_stack_arrays.rs b/clippy_lints/src/large_stack_arrays.rs index aa394c85e..e08042bcb 100644 --- a/clippy_lints/src/large_stack_arrays.rs +++ b/clippy_lints/src/large_stack_arrays.rs @@ -1,6 +1,6 @@ use rustc::mir::interpret::ConstValue; use rustc::ty::{self, ConstKind}; -use rustc_hir::*; +use rustc_hir::{Expr, ExprKind}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_tool_lint, impl_lint_pass}; diff --git a/clippy_lints/src/len_zero.rs b/clippy_lints/src/len_zero.rs index aa538a4be..821ca2fef 100644 --- a/clippy_lints/src/len_zero.rs +++ b/clippy_lints/src/len_zero.rs @@ -3,7 +3,7 @@ use rustc::ty; use rustc_data_structures::fx::FxHashSet; use rustc_errors::Applicability; use rustc_hir::def_id::DefId; -use rustc_hir::*; +use rustc_hir::{AssocItemKind, BinOpKind, Expr, ExprKind, ImplItemRef, Item, ItemKind, TraitItemRef}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::source_map::{Span, Spanned}; diff --git a/clippy_lints/src/let_underscore.rs b/clippy_lints/src/let_underscore.rs index c2a404ebe..5690a1214 100644 --- a/clippy_lints/src/let_underscore.rs +++ b/clippy_lints/src/let_underscore.rs @@ -1,6 +1,6 @@ use if_chain::if_chain; use rustc::lint::in_external_macro; -use rustc_hir::*; +use rustc_hir::{PatKind, Stmt, StmtKind}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; diff --git a/clippy_lints/src/lifetimes.rs b/clippy_lints/src/lifetimes.rs index f98021bca..a120e3a75 100644 --- a/clippy_lints/src/lifetimes.rs +++ b/clippy_lints/src/lifetimes.rs @@ -3,15 +3,21 @@ use rustc::hir::map::Map; use rustc::lint::in_external_macro; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_hir::def::{DefKind, Res}; -use rustc_hir::intravisit::*; +use rustc_hir::intravisit::{ + walk_fn_decl, walk_generic_param, walk_generics, walk_param_bound, walk_ty, NestedVisitorMap, Visitor, +}; use rustc_hir::FnRetTy::Return; -use rustc_hir::*; +use rustc_hir::{ + BodyId, FnDecl, GenericArg, GenericBound, GenericParam, GenericParamKind, Generics, ImplItem, ImplItemKind, Item, + ItemKind, Lifetime, LifetimeName, ParamName, QPath, TraitBoundModifier, TraitItem, TraitItemKind, TraitMethod, Ty, + TyKind, WhereClause, WherePredicate, +}; use rustc_lint::{LateContext, LateLintPass, LintContext}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::source_map::Span; use rustc_span::symbol::kw; -use crate::reexport::*; +use crate::reexport::Name; use crate::utils::{last_path_segment, span_lint, trait_ref_of_method}; declare_clippy_lint! { diff --git a/clippy_lints/src/literal_representation.rs b/clippy_lints/src/literal_representation.rs index 2419d4239..7c8001eeb 100644 --- a/clippy_lints/src/literal_representation.rs +++ b/clippy_lints/src/literal_representation.rs @@ -7,7 +7,7 @@ use rustc::lint::in_external_macro; use rustc_errors::Applicability; use rustc_lint::{EarlyContext, EarlyLintPass, LintContext}; use rustc_session::{declare_lint_pass, declare_tool_lint, impl_lint_pass}; -use syntax::ast::*; +use syntax::ast::{Expr, ExprKind, Lit, LitFloatType, LitIntType, LitKind}; declare_clippy_lint! { /// **What it does:** Warns if a long integral or floating-point constant does diff --git a/clippy_lints/src/loops.rs b/clippy_lints/src/loops.rs index 393fbd2aa..eb15b104b 100644 --- a/clippy_lints/src/loops.rs +++ b/clippy_lints/src/loops.rs @@ -1,5 +1,5 @@ use crate::consts::{constant, Constant}; -use crate::reexport::*; +use crate::reexport::Name; use crate::utils::paths; use crate::utils::usage::{is_unused, mutated_variables}; use crate::utils::{ @@ -19,13 +19,16 @@ use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_errors::Applicability; use rustc_hir::def::{DefKind, Res}; use rustc_hir::intravisit::{walk_block, walk_expr, walk_pat, walk_stmt, NestedVisitorMap, Visitor}; -use rustc_hir::*; +use rustc_hir::{ + def_id, BinOpKind, BindingAnnotation, Block, BorrowKind, Expr, ExprKind, GenericArg, HirId, LoopSource, + MatchSource, Mutability, Node, Pat, PatKind, QPath, Stmt, StmtKind, +}; use rustc_infer::infer::TyCtxtInferExt; use rustc_lint::{LateContext, LateLintPass, LintContext}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::source_map::Span; use rustc_span::{BytePos, Symbol}; -use rustc_typeck::expr_use_visitor::*; +use rustc_typeck::expr_use_visitor::{ConsumeMode, Delegate, ExprUseVisitor, Place, PlaceBase}; use std::iter::{once, Iterator}; use std::mem; use syntax::ast; diff --git a/clippy_lints/src/matches.rs b/clippy_lints/src/matches.rs index 721310843..d9d3611bc 100644 --- a/clippy_lints/src/matches.rs +++ b/clippy_lints/src/matches.rs @@ -12,7 +12,10 @@ use rustc::lint::in_external_macro; use rustc::ty::{self, Ty}; use rustc_errors::Applicability; use rustc_hir::def::CtorKind; -use rustc_hir::*; +use rustc_hir::{ + print, Arm, BindingAnnotation, Block, BorrowKind, Expr, ExprKind, Local, MatchSource, Mutability, PatKind, QPath, + RangeEnd, +}; use rustc_lint::{LateContext, LateLintPass, LintContext}; use rustc_session::{declare_tool_lint, impl_lint_pass}; use rustc_span::source_map::Span; diff --git a/clippy_lints/src/methods/manual_saturating_arithmetic.rs b/clippy_lints/src/methods/manual_saturating_arithmetic.rs index 4e3c95f9f..19f3c4478 100644 --- a/clippy_lints/src/methods/manual_saturating_arithmetic.rs +++ b/clippy_lints/src/methods/manual_saturating_arithmetic.rs @@ -23,7 +23,10 @@ pub fn lint(cx: &LateContext<'_, '_>, expr: &hir::Expr<'_>, args: &[&[hir::Expr< }; if ty.is_signed() { - use self::{MinMax::*, Sign::*}; + use self::{ + MinMax::{Max, Min}, + Sign::{Neg, Pos}, + }; let sign = if let Some(sign) = lit_sign(arith_rhs) { sign diff --git a/clippy_lints/src/methods/option_map_unwrap_or.rs b/clippy_lints/src/methods/option_map_unwrap_or.rs index 80a937aad..4df963a4f 100644 --- a/clippy_lints/src/methods/option_map_unwrap_or.rs +++ b/clippy_lints/src/methods/option_map_unwrap_or.rs @@ -4,7 +4,7 @@ use rustc::hir::map::Map; use rustc_data_structures::fx::FxHashSet; use rustc_errors::Applicability; use rustc_hir::intravisit::{walk_path, NestedVisitorMap, Visitor}; -use rustc_hir::{self, *}; +use rustc_hir::{self, HirId, Path}; use rustc_lint::LateContext; use rustc_span::source_map::Span; use rustc_span::symbol::Symbol; diff --git a/clippy_lints/src/minmax.rs b/clippy_lints/src/minmax.rs index b3431c053..b02c993de 100644 --- a/clippy_lints/src/minmax.rs +++ b/clippy_lints/src/minmax.rs @@ -1,6 +1,6 @@ use crate::consts::{constant_simple, Constant}; use crate::utils::{match_def_path, paths, span_lint}; -use rustc_hir::*; +use rustc_hir::{Expr, ExprKind}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use std::cmp::Ordering; diff --git a/clippy_lints/src/misc.rs b/clippy_lints/src/misc.rs index 583bdd43d..85d66db83 100644 --- a/clippy_lints/src/misc.rs +++ b/clippy_lints/src/misc.rs @@ -3,7 +3,10 @@ use matches::matches; use rustc::ty; use rustc_errors::Applicability; use rustc_hir::intravisit::FnKind; -use rustc_hir::*; +use rustc_hir::{ + def, BinOpKind, BindingAnnotation, Body, Expr, ExprKind, FnDecl, HirId, Mutability, PatKind, Stmt, StmtKind, Ty, + TyKind, UnOp, +}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::source_map::{ExpnKind, Span}; diff --git a/clippy_lints/src/misc_early.rs b/clippy_lints/src/misc_early.rs index 3f17ac3de..6e89f3514 100644 --- a/clippy_lints/src/misc_early.rs +++ b/clippy_lints/src/misc_early.rs @@ -9,7 +9,10 @@ use rustc_errors::Applicability; use rustc_lint::{EarlyContext, EarlyLintPass, LintContext}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::source_map::Span; -use syntax::ast::*; +use syntax::ast::{ + Block, Expr, ExprKind, GenericParamKind, Generics, Lit, LitFloatType, LitIntType, LitKind, NodeId, Pat, PatKind, + StmtKind, UnOp, +}; use syntax::visit::{walk_expr, FnKind, Visitor}; declare_clippy_lint! { diff --git a/clippy_lints/src/modulo_arithmetic.rs b/clippy_lints/src/modulo_arithmetic.rs index 238863e8c..7446b732c 100644 --- a/clippy_lints/src/modulo_arithmetic.rs +++ b/clippy_lints/src/modulo_arithmetic.rs @@ -2,7 +2,7 @@ use crate::consts::{constant, Constant}; use crate::utils::{sext, span_lint_and_then}; use if_chain::if_chain; use rustc::ty::{self}; -use rustc_hir::*; +use rustc_hir::{BinOpKind, Expr, ExprKind}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use std::fmt::Display; diff --git a/clippy_lints/src/mul_add.rs b/clippy_lints/src/mul_add.rs index 5de936634..57e56d8f9 100644 --- a/clippy_lints/src/mul_add.rs +++ b/clippy_lints/src/mul_add.rs @@ -1,9 +1,9 @@ use rustc_errors::Applicability; -use rustc_hir::*; +use rustc_hir::{BinOpKind, Expr, ExprKind}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; -use crate::utils::*; +use crate::utils::{snippet, span_lint_and_sugg}; declare_clippy_lint! { /// **What it does:** Checks for expressions of the form `a * b + c` diff --git a/clippy_lints/src/multiple_crate_versions.rs b/clippy_lints/src/multiple_crate_versions.rs index d07b21bfa..0bcce04e8 100644 --- a/clippy_lints/src/multiple_crate_versions.rs +++ b/clippy_lints/src/multiple_crate_versions.rs @@ -4,7 +4,7 @@ use crate::utils::span_lint; use rustc_lint::{EarlyContext, EarlyLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::source_map::DUMMY_SP; -use syntax::ast::*; +use syntax::ast::Crate; use itertools::Itertools; diff --git a/clippy_lints/src/mut_reference.rs b/clippy_lints/src/mut_reference.rs index 2d70b65bb..aeffcd341 100644 --- a/clippy_lints/src/mut_reference.rs +++ b/clippy_lints/src/mut_reference.rs @@ -1,7 +1,7 @@ use crate::utils::span_lint; use rustc::ty::subst::Subst; use rustc::ty::{self, Ty}; -use rustc_hir::*; +use rustc_hir::{print, BorrowKind, Expr, ExprKind, Mutability}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; diff --git a/clippy_lints/src/needless_bool.rs b/clippy_lints/src/needless_bool.rs index db4012146..7282874fd 100644 --- a/clippy_lints/src/needless_bool.rs +++ b/clippy_lints/src/needless_bool.rs @@ -5,7 +5,7 @@ use crate::utils::sugg::Sugg; use crate::utils::{higher, parent_node_is_if_expr, span_lint, span_lint_and_sugg}; use rustc_errors::Applicability; -use rustc_hir::*; +use rustc_hir::{BinOpKind, Block, Expr, ExprKind, StmtKind}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::source_map::Spanned; @@ -62,7 +62,7 @@ declare_lint_pass!(NeedlessBool => [NEEDLESS_BOOL]); impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NeedlessBool { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr<'_>) { - use self::Expression::*; + use self::Expression::{Bool, RetBool}; if let Some((ref pred, ref then_block, Some(ref else_expr))) = higher::if_block(&e) { let reduce = |ret, not| { let mut applicability = Applicability::MachineApplicable; @@ -191,7 +191,7 @@ fn check_comparison<'a, 'tcx>( right_false: Option<(impl FnOnce(Sugg<'a>) -> Sugg<'a>, &str)>, no_literal: Option<(impl FnOnce(Sugg<'a>, Sugg<'a>) -> Sugg<'a>, &str)>, ) { - use self::Expression::*; + use self::Expression::{Bool, Other}; if let ExprKind::Binary(_, ref left_side, ref right_side) = e.kind { let (l_ty, r_ty) = (cx.tables.expr_ty(left_side), cx.tables.expr_ty(right_side)); diff --git a/clippy_lints/src/needless_pass_by_value.rs b/clippy_lints/src/needless_pass_by_value.rs index 7a0f3bdd3..10782b9f3 100644 --- a/clippy_lints/src/needless_pass_by_value.rs +++ b/clippy_lints/src/needless_pass_by_value.rs @@ -9,7 +9,7 @@ use rustc::ty::{self, TypeFoldable}; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_errors::{Applicability, DiagnosticBuilder}; use rustc_hir::intravisit::FnKind; -use rustc_hir::*; +use rustc_hir::{BindingAnnotation, Body, FnDecl, GenericArg, HirId, ItemKind, Node, PatKind, QPath, TyKind}; use rustc_infer::infer::TyCtxtInferExt; use rustc_infer::traits; use rustc_infer::traits::misc::can_type_implement_copy; diff --git a/clippy_lints/src/neg_cmp_op_on_partial_ord.rs b/clippy_lints/src/neg_cmp_op_on_partial_ord.rs index efe5f26c4..65643d89d 100644 --- a/clippy_lints/src/neg_cmp_op_on_partial_ord.rs +++ b/clippy_lints/src/neg_cmp_op_on_partial_ord.rs @@ -1,6 +1,6 @@ use if_chain::if_chain; use rustc::lint::in_external_macro; -use rustc_hir::*; +use rustc_hir::{BinOpKind, Expr, ExprKind, UnOp}; use rustc_lint::{LateContext, LateLintPass, LintContext}; use rustc_session::{declare_lint_pass, declare_tool_lint}; diff --git a/clippy_lints/src/neg_multiply.rs b/clippy_lints/src/neg_multiply.rs index bd4ada237..4681e990d 100644 --- a/clippy_lints/src/neg_multiply.rs +++ b/clippy_lints/src/neg_multiply.rs @@ -1,5 +1,5 @@ use if_chain::if_chain; -use rustc_hir::*; +use rustc_hir::{BinOpKind, Expr, ExprKind, UnOp}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::source_map::Span; diff --git a/clippy_lints/src/non_copy_const.rs b/clippy_lints/src/non_copy_const.rs index 48ffc1135..46e26b326 100644 --- a/clippy_lints/src/non_copy_const.rs +++ b/clippy_lints/src/non_copy_const.rs @@ -7,7 +7,7 @@ use std::ptr; use rustc::ty::adjustment::Adjust; use rustc::ty::{Ty, TypeFlags}; use rustc_hir::def::{DefKind, Res}; -use rustc_hir::*; +use rustc_hir::{Expr, ExprKind, ImplItem, ImplItemKind, Item, ItemKind, Node, TraitItem, TraitItemKind, UnOp}; use rustc_lint::{LateContext, LateLintPass, Lint}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::{InnerSpan, Span, DUMMY_SP}; diff --git a/clippy_lints/src/non_expressive_names.rs b/clippy_lints/src/non_expressive_names.rs index 5411e3246..de5ae5d30 100644 --- a/clippy_lints/src/non_expressive_names.rs +++ b/clippy_lints/src/non_expressive_names.rs @@ -4,7 +4,9 @@ use rustc_session::{declare_tool_lint, impl_lint_pass}; use rustc_span::source_map::Span; use rustc_span::symbol::SymbolStr; use std::cmp::Ordering; -use syntax::ast::*; +use syntax::ast::{ + Arm, AssocItem, AssocItemKind, Attribute, Block, FnDecl, Ident, Item, ItemKind, Local, Mac, Pat, PatKind, +}; use syntax::attr; use syntax::visit::{walk_block, walk_expr, walk_pat, Visitor}; diff --git a/clippy_lints/src/option_env_unwrap.rs b/clippy_lints/src/option_env_unwrap.rs index 1af779349..6dc6893bf 100644 --- a/clippy_lints/src/option_env_unwrap.rs +++ b/clippy_lints/src/option_env_unwrap.rs @@ -2,7 +2,7 @@ use crate::utils::{is_direct_expn_of, span_lint_and_help}; use if_chain::if_chain; use rustc_lint::{EarlyContext, EarlyLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; -use syntax::ast::*; +use syntax::ast::{Expr, ExprKind}; declare_clippy_lint! { /// **What it does:** Checks for usage of `option_env!(...).unwrap()` and diff --git a/clippy_lints/src/overflow_check_conditional.rs b/clippy_lints/src/overflow_check_conditional.rs index df3f588f3..b90fdc232 100644 --- a/clippy_lints/src/overflow_check_conditional.rs +++ b/clippy_lints/src/overflow_check_conditional.rs @@ -1,6 +1,6 @@ use crate::utils::{span_lint, SpanlessEq}; use if_chain::if_chain; -use rustc_hir::*; +use rustc_hir::{BinOpKind, Expr, ExprKind, QPath}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; diff --git a/clippy_lints/src/panic_unimplemented.rs b/clippy_lints/src/panic_unimplemented.rs index b26ad1a5b..76a77e25d 100644 --- a/clippy_lints/src/panic_unimplemented.rs +++ b/clippy_lints/src/panic_unimplemented.rs @@ -1,6 +1,6 @@ use crate::utils::{is_direct_expn_of, is_expn_of, match_function_call, paths, span_lint}; use if_chain::if_chain; -use rustc_hir::*; +use rustc_hir::{Expr, ExprKind}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::Span; diff --git a/clippy_lints/src/partialeq_ne_impl.rs b/clippy_lints/src/partialeq_ne_impl.rs index dfd25f1c9..1445df41c 100644 --- a/clippy_lints/src/partialeq_ne_impl.rs +++ b/clippy_lints/src/partialeq_ne_impl.rs @@ -1,6 +1,6 @@ use crate::utils::{is_automatically_derived, span_lint_hir}; use if_chain::if_chain; -use rustc_hir::*; +use rustc_hir::{Item, ItemKind}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; diff --git a/clippy_lints/src/path_buf_push_overwrite.rs b/clippy_lints/src/path_buf_push_overwrite.rs index adaf8bb77..775a8ad0b 100644 --- a/clippy_lints/src/path_buf_push_overwrite.rs +++ b/clippy_lints/src/path_buf_push_overwrite.rs @@ -1,7 +1,7 @@ use crate::utils::{match_type, paths, span_lint_and_sugg, walk_ptrs_ty}; use if_chain::if_chain; use rustc_errors::Applicability; -use rustc_hir::*; +use rustc_hir::{Expr, ExprKind}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use std::path::{Component, Path}; diff --git a/clippy_lints/src/precedence.rs b/clippy_lints/src/precedence.rs index 27e67bbe7..8ba4e10c9 100644 --- a/clippy_lints/src/precedence.rs +++ b/clippy_lints/src/precedence.rs @@ -3,7 +3,7 @@ use rustc_errors::Applicability; use rustc_lint::{EarlyContext, EarlyLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::source_map::Spanned; -use syntax::ast::*; +use syntax::ast::{BinOpKind, Expr, ExprKind, LitKind, UnOp}; declare_clippy_lint! { /// **What it does:** Checks for operations where precedence may be unclear @@ -123,7 +123,7 @@ fn is_arith_expr(expr: &Expr) -> bool { #[must_use] fn is_bit_op(op: BinOpKind) -> bool { - use syntax::ast::BinOpKind::*; + use syntax::ast::BinOpKind::{BitAnd, BitOr, BitXor, Shl, Shr}; match op { BitXor | BitAnd | BitOr | Shl | Shr => true, _ => false, @@ -132,7 +132,7 @@ fn is_bit_op(op: BinOpKind) -> bool { #[must_use] fn is_arith_op(op: BinOpKind) -> bool { - use syntax::ast::BinOpKind::*; + use syntax::ast::BinOpKind::{Add, Div, Mul, Rem, Sub}; match op { Add | Sub | Mul | Div | Rem => true, _ => false, diff --git a/clippy_lints/src/ptr.rs b/clippy_lints/src/ptr.rs index d868253b8..c1aee94aa 100644 --- a/clippy_lints/src/ptr.rs +++ b/clippy_lints/src/ptr.rs @@ -8,7 +8,10 @@ use crate::utils::{ use if_chain::if_chain; use rustc::ty; use rustc_errors::Applicability; -use rustc_hir::*; +use rustc_hir::{ + BinOpKind, BodyId, Expr, ExprKind, FnDecl, FnRetTy, GenericArg, HirId, ImplItem, ImplItemKind, Item, ItemKind, + Lifetime, MutTy, Mutability, Node, PathSegment, QPath, TraitItem, TraitItemKind, TraitMethod, Ty, TyKind, +}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::source_map::Span; diff --git a/clippy_lints/src/question_mark.rs b/clippy_lints/src/question_mark.rs index 46c4746d2..f21c2985d 100644 --- a/clippy_lints/src/question_mark.rs +++ b/clippy_lints/src/question_mark.rs @@ -1,11 +1,11 @@ use if_chain::if_chain; use rustc_errors::Applicability; use rustc_hir::def::{DefKind, Res}; -use rustc_hir::*; +use rustc_hir::{def, Block, Expr, ExprKind, StmtKind}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; -use crate::utils::paths::*; +use crate::utils::paths::{OPTION, OPTION_NONE}; use crate::utils::sugg::Sugg; use crate::utils::{higher, match_def_path, match_type, span_lint_and_then, SpanlessEq}; diff --git a/clippy_lints/src/ranges.rs b/clippy_lints/src/ranges.rs index 1be597877..f1a93d508 100644 --- a/clippy_lints/src/ranges.rs +++ b/clippy_lints/src/ranges.rs @@ -1,6 +1,6 @@ use if_chain::if_chain; use rustc_errors::Applicability; -use rustc_hir::*; +use rustc_hir::{BinOpKind, Expr, ExprKind, QPath}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::source_map::Spanned; diff --git a/clippy_lints/src/redundant_clone.rs b/clippy_lints/src/redundant_clone.rs index e419ae09a..ddb0c7484 100644 --- a/clippy_lints/src/redundant_clone.rs +++ b/clippy_lints/src/redundant_clone.rs @@ -529,7 +529,7 @@ impl TypeVisitor<'_> for ContainsRegion { } fn rvalue_locals(rvalue: &mir::Rvalue<'_>, mut visit: impl FnMut(mir::Local)) { - use rustc::mir::Rvalue::*; + use rustc::mir::Rvalue::{Aggregate, BinaryOp, Cast, CheckedBinaryOp, Repeat, UnaryOp, Use}; let mut visit_op = |op: &mir::Operand<'_>| match op { mir::Operand::Copy(p) | mir::Operand::Move(p) => visit(p.local), diff --git a/clippy_lints/src/redundant_field_names.rs b/clippy_lints/src/redundant_field_names.rs index 57349715c..a839a023e 100644 --- a/clippy_lints/src/redundant_field_names.rs +++ b/clippy_lints/src/redundant_field_names.rs @@ -2,7 +2,7 @@ use crate::utils::span_lint_and_sugg; use rustc_errors::Applicability; use rustc_lint::{EarlyContext, EarlyLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; -use syntax::ast::*; +use syntax::ast::{Expr, ExprKind}; declare_clippy_lint! { /// **What it does:** Checks for fields in struct literals where shorthands diff --git a/clippy_lints/src/redundant_pattern_matching.rs b/clippy_lints/src/redundant_pattern_matching.rs index f0acd9934..c8706c2b3 100644 --- a/clippy_lints/src/redundant_pattern_matching.rs +++ b/clippy_lints/src/redundant_pattern_matching.rs @@ -1,6 +1,6 @@ use crate::utils::{match_qpath, paths, snippet, span_lint_and_then}; use rustc_errors::Applicability; -use rustc_hir::*; +use rustc_hir::{Arm, Expr, ExprKind, MatchSource, PatKind, QPath}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use syntax::ast::LitKind; diff --git a/clippy_lints/src/redundant_static_lifetimes.rs b/clippy_lints/src/redundant_static_lifetimes.rs index 9cebe310d..98ec793de 100644 --- a/clippy_lints/src/redundant_static_lifetimes.rs +++ b/clippy_lints/src/redundant_static_lifetimes.rs @@ -2,7 +2,7 @@ use crate::utils::{snippet, span_lint_and_then}; use rustc_errors::Applicability; use rustc_lint::{EarlyContext, EarlyLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; -use syntax::ast::*; +use syntax::ast::{Item, ItemKind, Ty, TyKind}; declare_clippy_lint! { /// **What it does:** Checks for constants and statics with an explicit `'static` lifetime. diff --git a/clippy_lints/src/regex.rs b/clippy_lints/src/regex.rs index 5de0e4413..028b89b39 100644 --- a/clippy_lints/src/regex.rs +++ b/clippy_lints/src/regex.rs @@ -2,7 +2,7 @@ use crate::consts::{constant, Constant}; use crate::utils::{is_expn_of, match_def_path, match_type, paths, span_lint, span_lint_and_help}; use if_chain::if_chain; use rustc_data_structures::fx::FxHashSet; -use rustc_hir::*; +use rustc_hir::{Block, BorrowKind, Crate, Expr, ExprKind, HirId}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_tool_lint, impl_lint_pass}; use rustc_span::source_map::{BytePos, Span}; @@ -145,8 +145,8 @@ fn const_str<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, e: &'tcx Expr<'_>) -> Option< } fn is_trivial_regex(s: ®ex_syntax::hir::Hir) -> Option<&'static str> { - use regex_syntax::hir::Anchor::*; - use regex_syntax::hir::HirKind::*; + use regex_syntax::hir::Anchor::{EndText, StartText}; + use regex_syntax::hir::HirKind::{Alternation, Anchor, Concat, Empty, Literal}; let is_literal = |e: &[regex_syntax::hir::Hir]| { e.iter().all(|e| match *e.kind() { diff --git a/clippy_lints/src/replace_consts.rs b/clippy_lints/src/replace_consts.rs index 66e1df72b..aca1ebbd5 100644 --- a/clippy_lints/src/replace_consts.rs +++ b/clippy_lints/src/replace_consts.rs @@ -2,7 +2,7 @@ use crate::utils::{match_def_path, span_lint_and_sugg}; use if_chain::if_chain; use rustc_errors::Applicability; use rustc_hir::def::{DefKind, Res}; -use rustc_hir::*; +use rustc_hir::{Expr, ExprKind, Node}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; diff --git a/clippy_lints/src/serde_api.rs b/clippy_lints/src/serde_api.rs index 63fdd599b..6820d1620 100644 --- a/clippy_lints/src/serde_api.rs +++ b/clippy_lints/src/serde_api.rs @@ -1,5 +1,5 @@ use crate::utils::{get_trait_def_id, paths, span_lint}; -use rustc_hir::*; +use rustc_hir::{Item, ItemKind}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; diff --git a/clippy_lints/src/shadow.rs b/clippy_lints/src/shadow.rs index 8e2ede044..0dc270555 100644 --- a/clippy_lints/src/shadow.rs +++ b/clippy_lints/src/shadow.rs @@ -1,9 +1,12 @@ -use crate::reexport::*; +use crate::reexport::Name; use crate::utils::{contains_name, higher, iter_input_pats, snippet, span_lint_and_then}; use rustc::lint::in_external_macro; use rustc::ty; use rustc_hir::intravisit::FnKind; -use rustc_hir::*; +use rustc_hir::{ + Block, Body, Expr, ExprKind, FnDecl, Guard, HirId, Local, MutTy, Pat, PatKind, Path, QPath, StmtKind, Ty, TyKind, + UnOp, +}; use rustc_lint::{LateContext, LateLintPass, LintContext}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::source_map::Span; diff --git a/clippy_lints/src/slow_vector_initialization.rs b/clippy_lints/src/slow_vector_initialization.rs index 48d0e53d1..71fcff335 100644 --- a/clippy_lints/src/slow_vector_initialization.rs +++ b/clippy_lints/src/slow_vector_initialization.rs @@ -4,7 +4,7 @@ use if_chain::if_chain; use rustc::hir::map::Map; use rustc_errors::Applicability; use rustc_hir::intravisit::{walk_block, walk_expr, walk_stmt, NestedVisitorMap, Visitor}; -use rustc_hir::*; +use rustc_hir::{BindingAnnotation, Block, Expr, ExprKind, HirId, PatKind, QPath, Stmt, StmtKind}; use rustc_lint::{LateContext, LateLintPass, Lint}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::symbol::Symbol; diff --git a/clippy_lints/src/strings.rs b/clippy_lints/src/strings.rs index ffe7c13ec..20ed4d9aa 100644 --- a/clippy_lints/src/strings.rs +++ b/clippy_lints/src/strings.rs @@ -1,6 +1,6 @@ use rustc::lint::in_external_macro; use rustc_errors::Applicability; -use rustc_hir::*; +use rustc_hir::{BinOpKind, Expr, ExprKind}; use rustc_lint::{LateContext, LateLintPass, LintContext}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::source_map::Spanned; diff --git a/clippy_lints/src/swap.rs b/clippy_lints/src/swap.rs index 7e699844e..a1f5dee2a 100644 --- a/clippy_lints/src/swap.rs +++ b/clippy_lints/src/swap.rs @@ -7,7 +7,7 @@ use if_chain::if_chain; use matches::matches; use rustc::ty; use rustc_errors::Applicability; -use rustc_hir::*; +use rustc_hir::{Block, Expr, ExprKind, PatKind, QPath, StmtKind}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::Symbol; diff --git a/clippy_lints/src/trait_bounds.rs b/clippy_lints/src/trait_bounds.rs index 858b50571..d343ec4a8 100644 --- a/clippy_lints/src/trait_bounds.rs +++ b/clippy_lints/src/trait_bounds.rs @@ -1,6 +1,6 @@ use crate::utils::{in_macro, snippet, span_lint_and_help, SpanlessHash}; use rustc_data_structures::fx::FxHashMap; -use rustc_hir::*; +use rustc_hir::{GenericBound, Generics, WherePredicate}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_tool_lint, impl_lint_pass}; diff --git a/clippy_lints/src/transmute.rs b/clippy_lints/src/transmute.rs index e6a9aa3c9..68c924cea 100644 --- a/clippy_lints/src/transmute.rs +++ b/clippy_lints/src/transmute.rs @@ -4,7 +4,7 @@ use crate::utils::{ use if_chain::if_chain; use rustc::ty::{self, Ty}; use rustc_errors::Applicability; -use rustc_hir::*; +use rustc_hir::{Expr, ExprKind, GenericArg, Mutability, QPath, TyKind, UnOp}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use std::borrow::Cow; diff --git a/clippy_lints/src/trivially_copy_pass_by_ref.rs b/clippy_lints/src/trivially_copy_pass_by_ref.rs index 1bacb4683..e00bc2e09 100644 --- a/clippy_lints/src/trivially_copy_pass_by_ref.rs +++ b/clippy_lints/src/trivially_copy_pass_by_ref.rs @@ -8,7 +8,7 @@ use rustc::ty; use rustc_errors::Applicability; use rustc_hir as hir; use rustc_hir::intravisit::FnKind; -use rustc_hir::*; +use rustc_hir::{Body, FnDecl, HirId, ItemKind, MutTy, Mutability, Node}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_tool_lint, impl_lint_pass}; use rustc_span::Span; diff --git a/clippy_lints/src/try_err.rs b/clippy_lints/src/try_err.rs index 15f77d622..a6624408c 100644 --- a/clippy_lints/src/try_err.rs +++ b/clippy_lints/src/try_err.rs @@ -3,7 +3,7 @@ use if_chain::if_chain; use rustc::lint::in_external_macro; use rustc::ty::Ty; use rustc_errors::Applicability; -use rustc_hir::*; +use rustc_hir::{Arm, Expr, ExprKind, MatchSource}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; diff --git a/clippy_lints/src/types.rs b/clippy_lints/src/types.rs index d23487b5b..e9c0b0935 100644 --- a/clippy_lints/src/types.rs +++ b/clippy_lints/src/types.rs @@ -12,7 +12,11 @@ use rustc::ty::{self, InferTy, Ty, TyCtxt, TypeckTables}; use rustc_errors::{Applicability, DiagnosticBuilder}; use rustc_hir as hir; use rustc_hir::intravisit::{walk_body, walk_expr, walk_ty, FnKind, NestedVisitorMap, Visitor}; -use rustc_hir::*; +use rustc_hir::{ + BinOpKind, Body, Expr, ExprKind, FnDecl, FnRetTy, FnSig, GenericArg, GenericParamKind, HirId, ImplItem, + ImplItemKind, Item, ItemKind, Lifetime, Local, MatchSource, MutTy, Mutability, QPath, Stmt, StmtKind, TraitItem, + TraitItemKind, TraitMethod, TyKind, UnOp, +}; use rustc_lint::{LateContext, LateLintPass, LintContext}; use rustc_session::{declare_lint_pass, declare_tool_lint, impl_lint_pass}; use rustc_span::hygiene::{ExpnKind, MacroKind}; @@ -1679,9 +1683,9 @@ fn detect_absurd_comparison<'a, 'tcx>( lhs: &'tcx Expr<'_>, rhs: &'tcx Expr<'_>, ) -> Option<(ExtremeExpr<'tcx>, AbsurdComparisonResult)> { - use crate::types::AbsurdComparisonResult::*; - use crate::types::ExtremeType::*; - use crate::utils::comparisons::*; + use crate::types::AbsurdComparisonResult::{AlwaysFalse, AlwaysTrue, InequalityImpossible}; + use crate::types::ExtremeType::{Maximum, Minimum}; + use crate::utils::comparisons::{normalize_comparison, Rel}; // absurd comparison only makes sense on primitive types // primitive types don't implement comparison operators with each other @@ -1726,7 +1730,7 @@ fn detect_absurd_comparison<'a, 'tcx>( } fn detect_extreme_expr<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr<'_>) -> Option> { - use crate::types::ExtremeType::*; + use crate::types::ExtremeType::{Maximum, Minimum}; let ty = cx.tables.expr_ty(expr); @@ -1755,8 +1759,8 @@ fn detect_extreme_expr<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr<'_ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AbsurdExtremeComparisons { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr<'_>) { - use crate::types::AbsurdComparisonResult::*; - use crate::types::ExtremeType::*; + use crate::types::AbsurdComparisonResult::{AlwaysFalse, AlwaysTrue, InequalityImpossible}; + use crate::types::ExtremeType::{Maximum, Minimum}; if let ExprKind::Binary(ref cmp, ref lhs, ref rhs) = expr.kind { if let Some((culprit, result)) = detect_absurd_comparison(cx, cmp.node, lhs, rhs) { @@ -1863,7 +1867,7 @@ impl Ord for FullInt { } fn numeric_cast_precast_bounds<'a>(cx: &LateContext<'_, '_>, expr: &'a Expr<'_>) -> Option<(FullInt, FullInt)> { - use std::*; + use std::{i128, i16, i32, i64, i8, isize, u128, u16, u32, u64, u8, usize}; if let ExprKind::Cast(ref cast_exp, _) = expr.kind { let pre_cast_ty = cx.tables.expr_ty(cast_exp); @@ -1963,7 +1967,7 @@ fn upcast_comparison_bounds_err<'a, 'tcx>( rhs: &'tcx Expr<'_>, invert: bool, ) { - use crate::utils::comparisons::*; + use crate::utils::comparisons::Rel; if let Some((lb, ub)) = lhs_bounds { if let Some(norm_rhs_val) = node_as_const_fullint(cx, rhs) { diff --git a/clippy_lints/src/unicode.rs b/clippy_lints/src/unicode.rs index eaf9f2e85..355d2ec0f 100644 --- a/clippy_lints/src/unicode.rs +++ b/clippy_lints/src/unicode.rs @@ -1,6 +1,6 @@ use crate::utils::{is_allowed, snippet, span_lint_and_sugg}; use rustc_errors::Applicability; -use rustc_hir::*; +use rustc_hir::{Expr, ExprKind, HirId}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::source_map::Span; diff --git a/clippy_lints/src/unsafe_removed_from_name.rs b/clippy_lints/src/unsafe_removed_from_name.rs index 023096398..2b2df4241 100644 --- a/clippy_lints/src/unsafe_removed_from_name.rs +++ b/clippy_lints/src/unsafe_removed_from_name.rs @@ -3,7 +3,7 @@ use rustc_lint::{EarlyContext, EarlyLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::source_map::Span; use rustc_span::symbol::SymbolStr; -use syntax::ast::*; +use syntax::ast::{Ident, Item, ItemKind, UseTree, UseTreeKind}; declare_clippy_lint! { /// **What it does:** Checks for imports that remove "unsafe" from an item's diff --git a/clippy_lints/src/unwrap.rs b/clippy_lints/src/unwrap.rs index 4fd421e4a..79dd93e64 100644 --- a/clippy_lints/src/unwrap.rs +++ b/clippy_lints/src/unwrap.rs @@ -2,8 +2,8 @@ use crate::utils::{higher::if_block, match_type, paths, span_lint_and_then, usag use if_chain::if_chain; use rustc::hir::map::Map; use rustc::lint::in_external_macro; -use rustc_hir::intravisit::*; -use rustc_hir::*; +use rustc_hir::intravisit::{walk_expr, walk_fn, FnKind, NestedVisitorMap, Visitor}; +use rustc_hir::{BinOpKind, Body, Expr, ExprKind, FnDecl, HirId, Path, QPath, UnOp}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::source_map::Span; diff --git a/clippy_lints/src/use_self.rs b/clippy_lints/src/use_self.rs index f1d66c1bc..4170dcc7f 100644 --- a/clippy_lints/src/use_self.rs +++ b/clippy_lints/src/use_self.rs @@ -7,7 +7,10 @@ use rustc_errors::Applicability; use rustc_hir as hir; use rustc_hir::def::{DefKind, Res}; use rustc_hir::intravisit::{walk_item, walk_path, walk_ty, NestedVisitorMap, Visitor}; -use rustc_hir::*; +use rustc_hir::{ + def, FnDecl, FnRetTy, FnSig, GenericArg, HirId, ImplItem, ImplItemKind, Item, ItemKind, Path, PathSegment, QPath, + TyKind, +}; use rustc_lint::{LateContext, LateLintPass, LintContext}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::symbol::kw; diff --git a/clippy_lints/src/utils/author.rs b/clippy_lints/src/utils/author.rs index 52ccdf95d..a4dc24cec 100644 --- a/clippy_lints/src/utils/author.rs +++ b/clippy_lints/src/utils/author.rs @@ -157,7 +157,7 @@ impl PrintVisitor { } fn next(&mut self, s: &'static str) -> String { - use std::collections::hash_map::Entry::*; + use std::collections::hash_map::Entry::{Occupied, Vacant}; match self.ids.entry(s) { // already there: start numbering from `1` Occupied(mut occ) => { diff --git a/clippy_lints/src/utils/hir_utils.rs b/clippy_lints/src/utils/hir_utils.rs index f5f35afa9..c62f95cd5 100644 --- a/clippy_lints/src/utils/hir_utils.rs +++ b/clippy_lints/src/utils/hir_utils.rs @@ -3,7 +3,11 @@ use crate::utils::differing_macro_contexts; use rustc::ich::StableHashingContextProvider; use rustc::ty::TypeckTables; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; -use rustc_hir::*; +use rustc_hir::{ + BinOpKind, Block, BlockCheckMode, BodyId, BorrowKind, CaptureBy, Expr, ExprKind, Field, FnRetTy, GenericArg, + GenericArgs, Guard, Lifetime, LifetimeName, ParamName, Pat, PatKind, Path, PathSegment, QPath, Stmt, StmtKind, Ty, + TyKind, TypeBinding, +}; use rustc_lint::LateContext; use std::hash::Hash; use syntax::ast::Name; diff --git a/clippy_lints/src/utils/internal_lints.rs b/clippy_lints/src/utils/internal_lints.rs index 759feafc7..85fee84cb 100644 --- a/clippy_lints/src/utils/internal_lints.rs +++ b/clippy_lints/src/utils/internal_lints.rs @@ -9,7 +9,7 @@ use rustc_errors::Applicability; use rustc_hir as hir; use rustc_hir::def::{DefKind, Res}; use rustc_hir::intravisit::{walk_expr, NestedVisitorMap, Visitor}; -use rustc_hir::*; +use rustc_hir::{Crate, Expr, ExprKind, HirId, Item, MutTy, Mutability, Path, Ty, TyKind}; use rustc_lint::{EarlyContext, EarlyLintPass, LateContext, LateLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint, impl_lint_pass}; use rustc_span::source_map::{Span, Spanned}; diff --git a/clippy_lints/src/utils/mod.rs b/clippy_lints/src/utils/mod.rs index b13648afd..2689cab28 100644 --- a/clippy_lints/src/utils/mod.rs +++ b/clippy_lints/src/utils/mod.rs @@ -40,7 +40,10 @@ use rustc_hir::def::{DefKind, Res}; use rustc_hir::def_id::{DefId, CRATE_DEF_INDEX, LOCAL_CRATE}; use rustc_hir::intravisit::{NestedVisitorMap, Visitor}; use rustc_hir::Node; -use rustc_hir::*; +use rustc_hir::{ + def, Arm, Block, Body, Constness, Crate, Expr, ExprKind, FnDecl, HirId, ImplItem, ImplItemKind, Item, ItemKind, + MatchSource, Param, Pat, PatKind, Path, PathSegment, QPath, TraitItem, TraitItemKind, TraitRef, TyKind, Unsafety, +}; use rustc_infer::infer::TyCtxtInferExt; use rustc_infer::traits::predicate_for_trait_def; use rustc_lint::{LateContext, Level, Lint, LintContext}; @@ -52,7 +55,7 @@ use smallvec::SmallVec; use syntax::ast::{self, Attribute, LitKind}; use crate::consts::{constant, Constant}; -use crate::reexport::*; +use crate::reexport::Name; /// Returns `true` if the two spans come from differing expansions (i.e., one is /// from a macro and one isn't). @@ -1289,7 +1292,7 @@ pub fn must_use_attr(attrs: &[Attribute]) -> Option<&Attribute> { // Returns whether the type has #[must_use] attribute pub fn is_must_use_ty<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, ty: Ty<'tcx>) -> bool { - use ty::TyKind::*; + use ty::TyKind::{Adt, Array, Dynamic, Foreign, Opaque, RawPtr, Ref, Slice, Tuple}; match ty.kind { Adt(ref adt, _) => must_use_attr(&cx.tcx.get_attrs(adt.did)).is_some(), Foreign(ref did) => must_use_attr(&cx.tcx.get_attrs(*did)).is_some(), diff --git a/clippy_lints/src/utils/ptr.rs b/clippy_lints/src/utils/ptr.rs index 8a59bcc98..3d97c18e9 100644 --- a/clippy_lints/src/utils/ptr.rs +++ b/clippy_lints/src/utils/ptr.rs @@ -1,7 +1,7 @@ use crate::utils::{get_pat_name, match_var, snippet}; use rustc::hir::map::Map; use rustc_hir::intravisit::{walk_expr, NestedVisitorMap, Visitor}; -use rustc_hir::*; +use rustc_hir::{Body, BodyId, Expr, ExprKind, Param}; use rustc_lint::LateContext; use rustc_span::source_map::Span; use std::borrow::Cow; diff --git a/clippy_lints/src/utils/sugg.rs b/clippy_lints/src/utils/sugg.rs index 5c9e3ab80..278505859 100644 --- a/clippy_lints/src/utils/sugg.rs +++ b/clippy_lints/src/utils/sugg.rs @@ -426,7 +426,10 @@ enum Associativity { /// associative. #[must_use] fn associativity(op: &AssocOp) -> Associativity { - use syntax::util::parser::AssocOp::*; + use syntax::util::parser::AssocOp::{ + Add, As, Assign, AssignOp, BitAnd, BitOr, BitXor, Colon, Divide, DotDot, DotDotEq, Equal, Greater, + GreaterEqual, LAnd, LOr, Less, LessEqual, Modulus, Multiply, NotEqual, ShiftLeft, ShiftRight, Subtract, + }; match *op { Assign | AssignOp(_) => Associativity::Right, @@ -439,7 +442,7 @@ fn associativity(op: &AssocOp) -> Associativity { /// Converts a `hir::BinOp` to the corresponding assigning binary operator. fn hirbinop2assignop(op: hir::BinOp) -> AssocOp { - use syntax::token::BinOpToken::*; + use syntax::token::BinOpToken::{And, Caret, Minus, Or, Percent, Plus, Shl, Shr, Slash, Star}; AssocOp::AssignOp(match op.node { hir::BinOpKind::Add => Plus, @@ -466,7 +469,9 @@ fn hirbinop2assignop(op: hir::BinOp) -> AssocOp { /// Converts an `ast::BinOp` to the corresponding assigning binary operator. fn astbinop2assignop(op: ast::BinOp) -> AssocOp { - use syntax::ast::BinOpKind::*; + use syntax::ast::BinOpKind::{ + Add, And, BitAnd, BitOr, BitXor, Div, Eq, Ge, Gt, Le, Lt, Mul, Ne, Or, Rem, Shl, Shr, Sub, + }; use syntax::token::BinOpToken; AssocOp::AssignOp(match op.node { diff --git a/clippy_lints/src/utils/usage.rs b/clippy_lints/src/utils/usage.rs index 8fff1c7a1..3e8b29295 100644 --- a/clippy_lints/src/utils/usage.rs +++ b/clippy_lints/src/utils/usage.rs @@ -4,11 +4,11 @@ use rustc::ty; use rustc_data_structures::fx::FxHashSet; use rustc_hir::def::Res; use rustc_hir::intravisit::{walk_expr, NestedVisitorMap, Visitor}; -use rustc_hir::*; +use rustc_hir::{def_id, Expr, HirId, Path}; use rustc_infer::infer::TyCtxtInferExt; use rustc_lint::LateContext; use rustc_span::symbol::Ident; -use rustc_typeck::expr_use_visitor::*; +use rustc_typeck::expr_use_visitor::{ConsumeMode, Delegate, ExprUseVisitor, Place, PlaceBase}; use syntax::ast; /// Returns a set of mutated local variable IDs, or `None` if mutations could not be determined. diff --git a/clippy_lints/src/vec.rs b/clippy_lints/src/vec.rs index bc2c827b0..726a34856 100644 --- a/clippy_lints/src/vec.rs +++ b/clippy_lints/src/vec.rs @@ -3,7 +3,7 @@ use crate::utils::{higher, is_copy, snippet_with_applicability, span_lint_and_su use if_chain::if_chain; use rustc::ty::{self, Ty}; use rustc_errors::Applicability; -use rustc_hir::*; +use rustc_hir::{BorrowKind, Expr, ExprKind}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::source_map::Span; diff --git a/clippy_lints/src/wildcard_dependencies.rs b/clippy_lints/src/wildcard_dependencies.rs index 2aa68842d..0be168d56 100644 --- a/clippy_lints/src/wildcard_dependencies.rs +++ b/clippy_lints/src/wildcard_dependencies.rs @@ -2,7 +2,7 @@ use crate::utils::span_lint; use rustc_lint::{EarlyContext, EarlyLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::source_map::DUMMY_SP; -use syntax::ast::*; +use syntax::ast::Crate; use if_chain::if_chain; diff --git a/clippy_lints/src/write.rs b/clippy_lints/src/write.rs index 0be52c2aa..904e2fab0 100644 --- a/clippy_lints/src/write.rs +++ b/clippy_lints/src/write.rs @@ -9,7 +9,7 @@ use rustc_parse::parser; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::symbol::Symbol; use rustc_span::{BytePos, Span}; -use syntax::ast::*; +use syntax::ast::{Expr, ExprKind, Mac, StrLit, StrStyle}; use syntax::token; use syntax::tokenstream::TokenStream; @@ -317,7 +317,9 @@ fn newline_span(fmtstr: &StrLit) -> Span { /// ``` #[allow(clippy::too_many_lines)] fn check_tts<'a>(cx: &EarlyContext<'a>, tts: &TokenStream, is_write: bool) -> (Option, Option) { - use fmt_macros::*; + use fmt_macros::{ + AlignUnknown, ArgumentImplicitlyIs, ArgumentIs, ArgumentNamed, CountImplied, FormatSpec, Parser, Piece, + }; let tts = tts.clone(); let mut parser = parser::Parser::new(&cx.sess.parse_sess, tts, None, false, false, None); diff --git a/clippy_lints/src/zero_div_zero.rs b/clippy_lints/src/zero_div_zero.rs index f36da5884..42cb9a77d 100644 --- a/clippy_lints/src/zero_div_zero.rs +++ b/clippy_lints/src/zero_div_zero.rs @@ -1,7 +1,7 @@ use crate::consts::{constant_simple, Constant}; use crate::utils::span_lint_and_help; use if_chain::if_chain; -use rustc_hir::*; +use rustc_hir::{BinOpKind, Expr, ExprKind}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; diff --git a/src/driver.rs b/src/driver.rs index 097b796e7..7865f6bb9 100644 --- a/src/driver.rs +++ b/src/driver.rs @@ -15,7 +15,7 @@ extern crate rustc_interface; use rustc::ty::TyCtxt; use rustc_interface::interface; -use rustc_tools_util::*; +use rustc_tools_util::VersionInfo; use lazy_static::lazy_static; use std::borrow::Cow; @@ -93,7 +93,7 @@ impl rustc_driver::Callbacks for ClippyCallbacks { #[allow(clippy::find_map, clippy::filter_map)] fn describe_lints() { - use lintlist::*; + use lintlist::{Level, Lint, ALL_LINTS, LINT_LEVELS}; use std::collections::HashSet; println!( diff --git a/src/main.rs b/src/main.rs index 8f9afb953..93e6996be 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,6 @@ #![cfg_attr(feature = "deny-warnings", deny(warnings))] -use rustc_tools_util::*; +use rustc_tools_util::VersionInfo; const CARGO_CLIPPY_HELP: &str = r#"Checks a package to catch common mistakes and improve your Rust code.