mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-27 15:11:30 +00:00
Auto merge of #5029 - flip1995:wildcard_imports, r=phansch
New Lint: `wildcard imports` Fixes #1228 ### A few notes: - I put this lint in the pedantic group, even though in the issue restriction was mentioned. - Every fallout fix was automatically applied by `cargo fix` (This produced 3 `unused_imports` warnings) and are in commit 7e834c8. So reverting these changes wouldn't be a problem. ### A few ideas: - A configuration to specify the amount of imported Items, where a `*` might be better. - ~~A configuration to disable the lint for enums. Or just disable the lint for enums, since there is [`enum_glob_use`](https://rust-lang.github.io/rust-clippy/master/index.html#enum_glob_use)~~ I moved `enum_glob_use` into this lint in 12937f0 ### A few quotes from the issue: > Is there a way to ask the compiler about the modules or symbols that the current file is using? Yes there is. I found it, once I was nearly finished implementing it myself. See 321d64a > one hard optional feature would be to figure out what is currently used and add a suggestion to replace it with a full import list. Yeah that was pretty hard, until I found the query for this. Queries are cool, but too hard to find. > FWIW VS Code and Intellij IDEA both offer imports deglobbing which replace * with required imports. And now, Clippy can do this too! 🎉 --- Your thoughts on the notes/ideas? changelog: Add new lint [`wildcard imports`]. Add suggestion to [`enum_glob_use`]
This commit is contained in:
commit
e342047068
130 changed files with 888 additions and 250 deletions
|
@ -1419,6 +1419,7 @@ Released 2018-09-13
|
|||
[`while_let_on_iterator`]: https://rust-lang.github.io/rust-clippy/master/index.html#while_let_on_iterator
|
||||
[`wildcard_dependencies`]: https://rust-lang.github.io/rust-clippy/master/index.html#wildcard_dependencies
|
||||
[`wildcard_enum_match_arm`]: https://rust-lang.github.io/rust-clippy/master/index.html#wildcard_enum_match_arm
|
||||
[`wildcard_imports`]: https://rust-lang.github.io/rust-clippy/master/index.html#wildcard_imports
|
||||
[`wildcard_in_or_patterns`]: https://rust-lang.github.io/rust-clippy/master/index.html#wildcard_in_or_patterns
|
||||
[`write_literal`]: https://rust-lang.github.io/rust-clippy/master/index.html#write_literal
|
||||
[`write_with_newline`]: https://rust-lang.github.io/rust-clippy/master/index.html#write_with_newline
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
A collection of lints to catch common mistakes and improve your [Rust](https://github.com/rust-lang/rust) code.
|
||||
|
||||
[There are 356 lints included in this crate!](https://rust-lang.github.io/rust-clippy/master/index.html)
|
||||
[There are 357 lints included in this crate!](https://rust-lang.github.io/rust-clippy/master/index.html)
|
||||
|
||||
We have a bunch of lint categories to allow you to choose how much Clippy is supposed to ~~annoy~~ help you:
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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};
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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};
|
||||
|
||||
|
|
|
@ -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};
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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};
|
||||
|
||||
|
|
|
@ -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<Ty<'_>>) -> 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<Constant> {
|
||||
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<Constant> {
|
||||
use self::Constant::*;
|
||||
use self::Constant::{Int, F32, F64};
|
||||
match *o {
|
||||
Int(value) => {
|
||||
let ity = match ty.kind {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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};
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -350,7 +350,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;
|
||||
|
@ -374,8 +374,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,
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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};
|
||||
|
||||
|
|
|
@ -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};
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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};
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -1,49 +0,0 @@
|
|||
//! lint on `use`ing all variants of an enum
|
||||
|
||||
use crate::utils::span_lint;
|
||||
use rustc_hir::def::{DefKind, Res};
|
||||
use rustc_hir::*;
|
||||
use rustc_lint::{LateContext, LateLintPass};
|
||||
use rustc_session::{declare_lint_pass, declare_tool_lint};
|
||||
use rustc_span::source_map::Span;
|
||||
|
||||
declare_clippy_lint! {
|
||||
/// **What it does:** Checks for `use Enum::*`.
|
||||
///
|
||||
/// **Why is this bad?** It is usually better style to use the prefixed name of
|
||||
/// an enumeration variant, rather than importing variants.
|
||||
///
|
||||
/// **Known problems:** Old-style enumerations that prefix the variants are
|
||||
/// still around.
|
||||
///
|
||||
/// **Example:**
|
||||
/// ```rust
|
||||
/// use std::cmp::Ordering::*;
|
||||
/// ```
|
||||
pub ENUM_GLOB_USE,
|
||||
pedantic,
|
||||
"use items that import all variants of an enum"
|
||||
}
|
||||
|
||||
declare_lint_pass!(EnumGlobUse => [ENUM_GLOB_USE]);
|
||||
|
||||
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EnumGlobUse {
|
||||
fn check_mod(&mut self, cx: &LateContext<'a, 'tcx>, m: &'tcx Mod<'_>, _: Span, _: HirId) {
|
||||
let map = cx.tcx.hir();
|
||||
// only check top level `use` statements
|
||||
for item in m.item_ids {
|
||||
lint_item(cx, map.expect_item(item.id));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn lint_item(cx: &LateContext<'_, '_>, item: &Item<'_>) {
|
||||
if item.vis.node.is_pub() {
|
||||
return; // re-exports are fine
|
||||
}
|
||||
if let ItemKind::Use(ref path, UseKind::Glob) = item.kind {
|
||||
if let Res::Def(DefKind::Enum, _) = path.res {
|
||||
span_lint(cx, ENUM_GLOB_USE, item.span, "don't use glob imports for enum variants");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -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};
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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};
|
||||
|
||||
|
|
|
@ -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};
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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>,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 `=-`
|
||||
|
|
|
@ -497,18 +497,17 @@ 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<DefId>) -> bool {
|
||||
use ty::TyKind::*;
|
||||
match ty.kind {
|
||||
// primitive types are never mutable
|
||||
Bool | Char | Int(_) | Uint(_) | Float(_) | Str => false,
|
||||
Adt(ref adt, ref substs) => {
|
||||
ty::Bool | ty::Char | ty::Int(_) | ty::Uint(_) | ty::Float(_) | ty::Str => false,
|
||||
ty::Adt(ref adt, ref substs) => {
|
||||
tys.insert(adt.did) && !ty.is_freeze(cx.tcx, cx.param_env, span)
|
||||
|| KNOWN_WRAPPER_TYS.iter().any(|path| match_def_path(cx, adt.did, path))
|
||||
&& substs.types().any(|ty| is_mutable_ty(cx, ty, span, tys))
|
||||
},
|
||||
Tuple(ref substs) => substs.types().any(|ty| is_mutable_ty(cx, ty, span, tys)),
|
||||
Array(ty, _) | Slice(ty) => is_mutable_ty(cx, ty, span, tys),
|
||||
RawPtr(ty::TypeAndMut { ty, mutbl }) | Ref(_, ty, mutbl) => {
|
||||
ty::Tuple(ref substs) => substs.types().any(|ty| is_mutable_ty(cx, ty, span, tys)),
|
||||
ty::Array(ty, _) | ty::Slice(ty) => is_mutable_ty(cx, ty, span, tys),
|
||||
ty::RawPtr(ty::TypeAndMut { ty, mutbl }) | ty::Ref(_, ty, mutbl) => {
|
||||
mutbl == hir::Mutability::Mut || is_mutable_ty(cx, ty, span, tys)
|
||||
},
|
||||
// calling something constitutes a side effect, so return true on all callables
|
||||
|
@ -593,7 +592,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 +630,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) => {
|
||||
|
|
|
@ -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};
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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};
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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};
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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};
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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};
|
||||
|
||||
|
|
|
@ -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};
|
||||
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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};
|
||||
|
||||
|
|
|
@ -197,7 +197,6 @@ pub mod else_if_without_else;
|
|||
pub mod empty_enum;
|
||||
pub mod entry;
|
||||
pub mod enum_clike;
|
||||
pub mod enum_glob_use;
|
||||
pub mod enum_variants;
|
||||
pub mod eq_op;
|
||||
pub mod erasing_op;
|
||||
|
@ -311,6 +310,7 @@ pub mod unwrap;
|
|||
pub mod use_self;
|
||||
pub mod vec;
|
||||
pub mod wildcard_dependencies;
|
||||
pub mod wildcard_imports;
|
||||
pub mod write;
|
||||
pub mod zero_div_zero;
|
||||
// end lints modules, do not remove this comment, it’s used in `update_lints`
|
||||
|
@ -519,7 +519,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
|
|||
&empty_enum::EMPTY_ENUM,
|
||||
&entry::MAP_ENTRY,
|
||||
&enum_clike::ENUM_CLIKE_UNPORTABLE_VARIANT,
|
||||
&enum_glob_use::ENUM_GLOB_USE,
|
||||
&enum_variants::ENUM_VARIANT_NAMES,
|
||||
&enum_variants::MODULE_INCEPTION,
|
||||
&enum_variants::MODULE_NAME_REPETITIONS,
|
||||
|
@ -813,6 +812,8 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
|
|||
&use_self::USE_SELF,
|
||||
&vec::USELESS_VEC,
|
||||
&wildcard_dependencies::WILDCARD_DEPENDENCIES,
|
||||
&wildcard_imports::ENUM_GLOB_USE,
|
||||
&wildcard_imports::WILDCARD_IMPORTS,
|
||||
&write::PRINTLN_EMPTY_STRING,
|
||||
&write::PRINT_LITERAL,
|
||||
&write::PRINT_STDOUT,
|
||||
|
@ -835,7 +836,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
|
|||
store.register_late_pass(move || box types::Types::new(vec_box_size_threshold));
|
||||
store.register_late_pass(|| box booleans::NonminimalBool);
|
||||
store.register_late_pass(|| box eq_op::EqOp);
|
||||
store.register_late_pass(|| box enum_glob_use::EnumGlobUse);
|
||||
store.register_late_pass(|| box enum_clike::UnportableVariant);
|
||||
store.register_late_pass(|| box float_literal::FloatLiteral);
|
||||
let verbose_bit_mask_threshold = conf.verbose_bit_mask_threshold;
|
||||
|
@ -1009,6 +1009,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
|
|||
let max_struct_bools = conf.max_struct_bools;
|
||||
store.register_early_pass(move || box excessive_bools::ExcessiveBools::new(max_struct_bools, max_fn_params_bools));
|
||||
store.register_early_pass(|| box option_env_unwrap::OptionEnvUnwrap);
|
||||
store.register_late_pass(|| box wildcard_imports::WildcardImports);
|
||||
|
||||
store.register_group(true, "clippy::restriction", Some("clippy_restriction"), vec![
|
||||
LintId::of(&arithmetic::FLOAT_ARITHMETIC),
|
||||
|
@ -1061,7 +1062,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
|
|||
LintId::of(&doc::DOC_MARKDOWN),
|
||||
LintId::of(&doc::MISSING_ERRORS_DOC),
|
||||
LintId::of(&empty_enum::EMPTY_ENUM),
|
||||
LintId::of(&enum_glob_use::ENUM_GLOB_USE),
|
||||
LintId::of(&enum_variants::MODULE_NAME_REPETITIONS),
|
||||
LintId::of(&enum_variants::PUB_ENUM_VARIANT_NAMES),
|
||||
LintId::of(&eta_reduction::REDUNDANT_CLOSURE_FOR_METHOD_CALLS),
|
||||
|
@ -1105,6 +1105,8 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
|
|||
LintId::of(&unicode::NON_ASCII_LITERAL),
|
||||
LintId::of(&unicode::UNICODE_NOT_NFC),
|
||||
LintId::of(&unused_self::UNUSED_SELF),
|
||||
LintId::of(&wildcard_imports::ENUM_GLOB_USE),
|
||||
LintId::of(&wildcard_imports::WILDCARD_IMPORTS),
|
||||
]);
|
||||
|
||||
store.register_group(true, "clippy::internal", Some("clippy_internal"), vec![
|
||||
|
|
|
@ -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! {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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! {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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`
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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};
|
||||
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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};
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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};
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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};
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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};
|
||||
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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};
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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};
|
||||
|
||||
|
|
|
@ -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};
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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};
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue