mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-10 15:14:29 +00:00
Auto merge of #6916 - camsteffen:diagnostics-util, r=Manishearth
Don't re-export `clippy_utils::diagnostics::*` changelog: none Continues #6907
This commit is contained in:
commit
99ecb6189d
307 changed files with 530 additions and 368 deletions
|
@ -1,4 +1,4 @@
|
|||
use crate::utils::span_lint;
|
||||
use clippy_utils::diagnostics::span_lint;
|
||||
use rustc_ast::ast::{FloatTy, LitFloatType, LitKind};
|
||||
use rustc_hir::{Expr, ExprKind};
|
||||
use rustc_lint::{LateContext, LateLintPass};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use crate::consts::constant_simple;
|
||||
use crate::utils::span_lint;
|
||||
use clippy_utils::diagnostics::span_lint;
|
||||
use rustc_hir as hir;
|
||||
use rustc_lint::{LateContext, LateLintPass};
|
||||
use rustc_session::{declare_tool_lint, impl_lint_pass};
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
use clippy_utils::diagnostics::span_lint_and_help;
|
||||
use rustc_ast::ast::{Expr, ExprKind};
|
||||
use rustc_lint::{EarlyContext, EarlyLintPass, LintContext};
|
||||
use rustc_middle::lint::in_external_macro;
|
||||
use rustc_session::{declare_lint_pass, declare_tool_lint};
|
||||
|
||||
use crate::utils::span_lint_and_help;
|
||||
|
||||
declare_clippy_lint! {
|
||||
/// **What it does:** Checks for usage of `as` conversions.
|
||||
///
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use std::fmt;
|
||||
|
||||
use crate::utils::span_lint_and_help;
|
||||
use clippy_utils::diagnostics::span_lint_and_help;
|
||||
use rustc_ast::ast::{Expr, ExprKind, InlineAsmOptions};
|
||||
use rustc_lint::{EarlyContext, EarlyLintPass, Lint};
|
||||
use rustc_session::{declare_lint_pass, declare_tool_lint};
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use crate::consts::{constant, Constant};
|
||||
use crate::utils::{is_direct_expn_of, is_expn_of, match_panic_call, span_lint_and_help};
|
||||
use crate::utils::{is_direct_expn_of, is_expn_of, match_panic_call};
|
||||
use clippy_utils::diagnostics::span_lint_and_help;
|
||||
use clippy_utils::source::snippet_opt;
|
||||
use if_chain::if_chain;
|
||||
use rustc_hir::{Expr, ExprKind, UnOp};
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use crate::utils::{eq_expr_value, get_trait_def_id, span_lint_and_then, trait_ref_of_method};
|
||||
use crate::utils::{eq_expr_value, get_trait_def_id, trait_ref_of_method};
|
||||
use crate::utils::{higher, sugg};
|
||||
use clippy_utils::diagnostics::span_lint_and_then;
|
||||
use clippy_utils::source::snippet_opt;
|
||||
use clippy_utils::ty::implements_trait;
|
||||
use if_chain::if_chain;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use crate::utils::span_lint_and_then;
|
||||
use clippy_utils::diagnostics::span_lint_and_then;
|
||||
use clippy_utils::source::snippet;
|
||||
use clippy_utils::ty::implements_trait;
|
||||
use rustc_errors::Applicability;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use crate::utils::{match_def_path, span_lint_and_help};
|
||||
use crate::utils::match_def_path;
|
||||
use clippy_utils::diagnostics::span_lint_and_help;
|
||||
use if_chain::if_chain;
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_hir::{Expr, ExprKind};
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
//! checks for attributes
|
||||
|
||||
use crate::utils::{match_panic_def_id, span_lint, span_lint_and_help, span_lint_and_sugg, span_lint_and_then};
|
||||
use crate::utils::match_panic_def_id;
|
||||
use clippy_utils::diagnostics::{span_lint, span_lint_and_help, span_lint_and_sugg, span_lint_and_then};
|
||||
use clippy_utils::source::{first_line_of_span, is_present_in_source, snippet_opt, without_block_comments};
|
||||
use if_chain::if_chain;
|
||||
use rustc_ast::{AttrKind, AttrStyle, Attribute, Lit, LitKind, MetaItemKind, NestedMetaItem};
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use crate::utils::{match_def_path, paths, span_lint_and_note};
|
||||
use crate::utils::{match_def_path, paths};
|
||||
use clippy_utils::diagnostics::span_lint_and_note;
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_hir::{AsyncGeneratorKind, Body, BodyId, GeneratorKind};
|
||||
use rustc_lint::{LateContext, LateLintPass};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use crate::consts::{constant, Constant};
|
||||
use crate::utils::sugg::Sugg;
|
||||
use crate::utils::{span_lint, span_lint_and_then};
|
||||
use clippy_utils::diagnostics::{span_lint, span_lint_and_then};
|
||||
use if_chain::if_chain;
|
||||
use rustc_ast::ast::LitKind;
|
||||
use rustc_errors::Applicability;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use crate::utils::span_lint;
|
||||
use clippy_utils::diagnostics::span_lint;
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_hir::{Pat, PatKind};
|
||||
use rustc_lint::{LateContext, LateLintPass};
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use crate::utils::{differing_macro_contexts, get_parent_expr, span_lint, span_lint_and_sugg};
|
||||
use crate::utils::{differing_macro_contexts, get_parent_expr};
|
||||
use clippy_utils::diagnostics::{span_lint, span_lint_and_sugg};
|
||||
use clippy_utils::source::snippet_block_with_applicability;
|
||||
use clippy_utils::ty::implements_trait;
|
||||
use if_chain::if_chain;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use crate::utils::{eq_expr_value, get_trait_def_id, in_macro, paths, span_lint_and_sugg, span_lint_and_then};
|
||||
use crate::utils::{eq_expr_value, get_trait_def_id, in_macro, paths};
|
||||
use clippy_utils::diagnostics::{span_lint_and_sugg, span_lint_and_then};
|
||||
use clippy_utils::source::snippet_opt;
|
||||
use clippy_utils::ty::{implements_trait, is_type_diagnostic_item};
|
||||
use if_chain::if_chain;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use crate::utils::{contains_name, get_pat_name, paths, single_segment_path, span_lint_and_sugg};
|
||||
use crate::utils::{contains_name, get_pat_name, paths, single_segment_path};
|
||||
use clippy_utils::diagnostics::span_lint_and_sugg;
|
||||
use clippy_utils::source::snippet_with_applicability;
|
||||
use clippy_utils::ty::match_type;
|
||||
use if_chain::if_chain;
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
|
||||
use std::path::PathBuf;
|
||||
|
||||
use crate::utils::{run_lints, span_lint};
|
||||
use crate::utils::run_lints;
|
||||
use clippy_utils::diagnostics::span_lint;
|
||||
use rustc_hir::{hir_id::CRATE_HIR_ID, Crate};
|
||||
use rustc_lint::{LateContext, LateLintPass};
|
||||
use rustc_session::{declare_tool_lint, impl_lint_pass};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use crate::utils::span_lint_and_help;
|
||||
use clippy_utils::diagnostics::span_lint_and_help;
|
||||
use if_chain::if_chain;
|
||||
use rustc_ast::ast::LitKind;
|
||||
use rustc_hir::{Expr, ExprKind, PathSegment};
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
use clippy_utils::diagnostics::span_lint_and_sugg;
|
||||
use clippy_utils::source::snippet_opt;
|
||||
use clippy_utils::ty::is_isize_or_usize;
|
||||
use rustc_errors::Applicability;
|
||||
|
@ -5,7 +6,7 @@ use rustc_hir::{Expr, ExprKind};
|
|||
use rustc_lint::LateContext;
|
||||
use rustc_middle::ty::{self, FloatTy, Ty};
|
||||
|
||||
use crate::utils::{in_constant, span_lint_and_sugg};
|
||||
use crate::utils::in_constant;
|
||||
|
||||
use super::{utils, CAST_LOSSLESS};
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ use rustc_hir::Expr;
|
|||
use rustc_lint::LateContext;
|
||||
use rustc_middle::ty::{self, FloatTy, Ty};
|
||||
|
||||
use crate::utils::span_lint;
|
||||
use clippy_utils::diagnostics::span_lint;
|
||||
|
||||
use super::{utils, CAST_POSSIBLE_TRUNCATION};
|
||||
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
use clippy_utils::diagnostics::span_lint;
|
||||
use clippy_utils::ty::is_isize_or_usize;
|
||||
use rustc_hir::Expr;
|
||||
use rustc_lint::LateContext;
|
||||
use rustc_middle::ty::Ty;
|
||||
|
||||
use crate::utils::span_lint;
|
||||
|
||||
use super::{utils, CAST_POSSIBLE_WRAP};
|
||||
|
||||
pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, cast_from: Ty<'_>, cast_to: Ty<'_>) {
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
use clippy_utils::diagnostics::span_lint;
|
||||
use clippy_utils::ty::is_isize_or_usize;
|
||||
use rustc_hir::Expr;
|
||||
use rustc_lint::LateContext;
|
||||
use rustc_middle::ty::{self, FloatTy, Ty};
|
||||
|
||||
use crate::utils::span_lint;
|
||||
|
||||
use super::{utils, CAST_PRECISION_LOSS};
|
||||
|
||||
pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, cast_from: Ty<'_>, cast_to: Ty<'_>) {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
use clippy_utils::diagnostics::span_lint;
|
||||
use rustc_hir::{Expr, ExprKind, GenericArg};
|
||||
use rustc_lint::LateContext;
|
||||
use rustc_middle::ty::{self, Ty};
|
||||
|
@ -6,7 +7,7 @@ use rustc_target::abi::LayoutOf;
|
|||
|
||||
use if_chain::if_chain;
|
||||
|
||||
use crate::utils::{is_hir_ty_cfg_dependant, span_lint};
|
||||
use crate::utils::is_hir_ty_cfg_dependant;
|
||||
|
||||
use super::CAST_PTR_ALIGNMENT;
|
||||
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
use clippy_utils::diagnostics::span_lint;
|
||||
use if_chain::if_chain;
|
||||
use rustc_hir::{Expr, ExprKind, MutTy, Mutability, TyKind, UnOp};
|
||||
use rustc_lint::LateContext;
|
||||
use rustc_middle::ty;
|
||||
|
||||
use if_chain::if_chain;
|
||||
|
||||
use crate::utils::span_lint;
|
||||
|
||||
use super::CAST_REF_TO_MUT;
|
||||
|
||||
pub(super) fn check(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
|
||||
|
|
|
@ -5,7 +5,8 @@ use rustc_middle::ty::{self, Ty};
|
|||
use if_chain::if_chain;
|
||||
|
||||
use crate::consts::{constant, Constant};
|
||||
use crate::utils::{method_chain_args, sext, span_lint};
|
||||
use crate::utils::{method_chain_args, sext};
|
||||
use clippy_utils::diagnostics::span_lint;
|
||||
|
||||
use super::CAST_SIGN_LOSS;
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
use clippy_utils::diagnostics::span_lint_and_then;
|
||||
use clippy_utils::source::snippet_with_applicability;
|
||||
use if_chain::if_chain;
|
||||
use rustc_ast::LitKind;
|
||||
|
@ -6,8 +7,6 @@ use rustc_hir::{Expr, ExprKind};
|
|||
use rustc_lint::LateContext;
|
||||
use rustc_middle::ty::{self, UintTy};
|
||||
|
||||
use crate::utils::span_lint_and_then;
|
||||
|
||||
use super::CHAR_LIT_AS_U8;
|
||||
|
||||
pub(super) fn check(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use crate::utils::span_lint_and_sugg;
|
||||
use clippy_utils::diagnostics::span_lint_and_sugg;
|
||||
use clippy_utils::source::snippet_with_applicability;
|
||||
use rustc_errors::Applicability;
|
||||
use rustc_hir::Expr;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use crate::utils::span_lint_and_sugg;
|
||||
use clippy_utils::diagnostics::span_lint_and_sugg;
|
||||
use clippy_utils::source::snippet_with_applicability;
|
||||
use rustc_errors::Applicability;
|
||||
use rustc_hir::Expr;
|
||||
|
|
|
@ -8,8 +8,9 @@ use rustc_semver::RustcVersion;
|
|||
|
||||
use if_chain::if_chain;
|
||||
|
||||
use crate::utils::meets_msrv;
|
||||
use crate::utils::sugg::Sugg;
|
||||
use crate::utils::{meets_msrv, span_lint_and_sugg};
|
||||
use clippy_utils::diagnostics::span_lint_and_sugg;
|
||||
|
||||
use super::PTR_AS_PTR;
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
use clippy_utils::diagnostics::span_lint_and_sugg;
|
||||
use clippy_utils::source::snippet_opt;
|
||||
use if_chain::if_chain;
|
||||
use rustc_ast::{LitFloatType, LitIntType, LitKind};
|
||||
|
@ -7,7 +8,7 @@ use rustc_lint::{LateContext, LintContext};
|
|||
use rustc_middle::lint::in_external_macro;
|
||||
use rustc_middle::ty::{self, FloatTy, InferTy, Ty};
|
||||
|
||||
use crate::utils::{numeric_literal::NumericLiteral, span_lint_and_sugg};
|
||||
use crate::utils::numeric_literal::NumericLiteral;
|
||||
|
||||
use super::UNNECESSARY_CAST;
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
//! lint on manually implemented checked conversions that could be transformed into `try_from`
|
||||
|
||||
use clippy_utils::diagnostics::span_lint_and_sugg;
|
||||
use clippy_utils::source::snippet_with_applicability;
|
||||
use if_chain::if_chain;
|
||||
use rustc_ast::ast::LitKind;
|
||||
|
@ -10,7 +11,7 @@ use rustc_middle::lint::in_external_macro;
|
|||
use rustc_semver::RustcVersion;
|
||||
use rustc_session::{declare_tool_lint, impl_lint_pass};
|
||||
|
||||
use crate::utils::{meets_msrv, span_lint_and_sugg, SpanlessEq};
|
||||
use crate::utils::{meets_msrv, SpanlessEq};
|
||||
|
||||
const CHECKED_CONVERSIONS_MSRV: RustcVersion = RustcVersion::new(1, 34, 0);
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
//! calculate cognitive complexity and warn about overly complex functions
|
||||
|
||||
use clippy_utils::diagnostics::span_lint_and_help;
|
||||
use clippy_utils::source::snippet_opt;
|
||||
use clippy_utils::ty::is_type_diagnostic_item;
|
||||
use rustc_ast::ast::Attribute;
|
||||
|
@ -11,7 +12,7 @@ use rustc_session::{declare_tool_lint, impl_lint_pass};
|
|||
use rustc_span::source_map::Span;
|
||||
use rustc_span::{sym, BytePos};
|
||||
|
||||
use crate::utils::{span_lint_and_help, LimitStack};
|
||||
use crate::utils::LimitStack;
|
||||
|
||||
declare_clippy_lint! {
|
||||
/// **What it does:** Checks for methods with high cognitive complexity.
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
//!
|
||||
//! This lint is **warn** by default
|
||||
|
||||
use clippy_utils::diagnostics::{span_lint_and_sugg, span_lint_and_then};
|
||||
use clippy_utils::source::{snippet_block, snippet_block_with_applicability};
|
||||
use if_chain::if_chain;
|
||||
use rustc_ast::ast;
|
||||
|
@ -20,7 +21,6 @@ use rustc_lint::{EarlyContext, EarlyLintPass};
|
|||
use rustc_session::{declare_lint_pass, declare_tool_lint};
|
||||
|
||||
use crate::utils::sugg::Sugg;
|
||||
use crate::utils::{span_lint_and_sugg, span_lint_and_then};
|
||||
|
||||
declare_clippy_lint! {
|
||||
/// **What it does:** Checks for nested `if` statements which can be collapsed
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use crate::utils::visitors::LocalUsedVisitor;
|
||||
use crate::utils::{path_to_local, span_lint_and_then, SpanlessEq};
|
||||
use crate::utils::{path_to_local, SpanlessEq};
|
||||
use clippy_utils::diagnostics::span_lint_and_then;
|
||||
use if_chain::if_chain;
|
||||
use rustc_hir::def::{CtorKind, CtorOf, DefKind, Res};
|
||||
use rustc_hir::{Arm, Expr, ExprKind, Guard, HirId, Pat, PatKind, QPath, StmtKind, UnOp};
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use crate::utils::{get_trait_def_id, if_sequence, parent_node_is_if_expr, paths, span_lint_and_help, SpanlessEq};
|
||||
use crate::utils::{get_trait_def_id, if_sequence, parent_node_is_if_expr, paths, SpanlessEq};
|
||||
use clippy_utils::diagnostics::span_lint_and_help;
|
||||
use clippy_utils::ty::implements_trait;
|
||||
use rustc_hir::{BinOpKind, Expr, ExprKind};
|
||||
use rustc_lint::{LateContext, LateLintPass};
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use crate::utils::{eq_expr_value, in_macro, search_same, SpanlessEq, SpanlessHash};
|
||||
use crate::utils::{get_parent_expr, if_sequence, span_lint_and_note};
|
||||
use crate::utils::{get_parent_expr, if_sequence};
|
||||
use clippy_utils::diagnostics::span_lint_and_note;
|
||||
use rustc_hir::{Block, Expr, ExprKind};
|
||||
use rustc_lint::{LateContext, LateLintPass};
|
||||
use rustc_session::{declare_lint_pass, declare_tool_lint};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use crate::utils::span_lint_and_note;
|
||||
use clippy_utils::diagnostics::span_lint_and_note;
|
||||
use clippy_utils::ty::is_copy;
|
||||
use rustc_hir::{Impl, Item, ItemKind};
|
||||
use rustc_lint::{LateContext, LateLintPass};
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use crate::utils::{match_def_path, paths, span_lint_and_sugg};
|
||||
use crate::utils::{match_def_path, paths};
|
||||
use clippy_utils::diagnostics::span_lint_and_sugg;
|
||||
use clippy_utils::source::snippet;
|
||||
use if_chain::if_chain;
|
||||
use rustc_errors::Applicability;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use crate::utils::{span_lint_and_help, span_lint_and_sugg};
|
||||
use clippy_utils::diagnostics::{span_lint_and_help, span_lint_and_sugg};
|
||||
use clippy_utils::source::snippet_opt;
|
||||
use rustc_ast::ast;
|
||||
use rustc_ast::tokenstream::TokenStream;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use crate::utils::{any_parent_is_automatically_derived, contains_name, match_def_path, paths};
|
||||
use crate::utils::{span_lint_and_note, span_lint_and_sugg};
|
||||
use clippy_utils::diagnostics::{span_lint_and_note, span_lint_and_sugg};
|
||||
use clippy_utils::source::snippet_with_macro_callsite;
|
||||
use if_chain::if_chain;
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
use clippy_utils::diagnostics::span_lint_and_sugg;
|
||||
use clippy_utils::source::snippet;
|
||||
use if_chain::if_chain;
|
||||
use rustc_ast::ast::{LitFloatType, LitIntType, LitKind};
|
||||
|
@ -13,8 +14,6 @@ use rustc_middle::{
|
|||
};
|
||||
use rustc_session::{declare_lint_pass, declare_tool_lint};
|
||||
|
||||
use crate::utils::span_lint_and_sugg;
|
||||
|
||||
declare_clippy_lint! {
|
||||
/// **What it does:** Checks for usage of unconstrained numeric literals which may cause default numeric fallback in type
|
||||
/// inference.
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use crate::utils::{get_parent_node, in_macro, is_allowed, span_lint_and_sugg};
|
||||
use crate::utils::{get_parent_node, in_macro, is_allowed};
|
||||
use clippy_utils::diagnostics::span_lint_and_sugg;
|
||||
use clippy_utils::source::snippet_with_context;
|
||||
use clippy_utils::ty::peel_mid_ty_refs;
|
||||
use rustc_ast::util::parser::PREC_PREFIX;
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
use crate::utils::paths;
|
||||
use crate::utils::{
|
||||
get_trait_def_id, is_allowed, is_automatically_derived, match_def_path, span_lint_and_help, span_lint_and_note,
|
||||
span_lint_and_then,
|
||||
};
|
||||
use crate::utils::{get_trait_def_id, is_allowed, is_automatically_derived, match_def_path};
|
||||
use clippy_utils::diagnostics::{span_lint_and_help, span_lint_and_note, span_lint_and_then};
|
||||
use clippy_utils::ty::is_copy;
|
||||
use if_chain::if_chain;
|
||||
use rustc_hir::def_id::DefId;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use crate::utils::{fn_def_id, span_lint};
|
||||
use crate::utils::fn_def_id;
|
||||
use clippy_utils::diagnostics::span_lint;
|
||||
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_hir::Expr;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
use crate::utils::{
|
||||
is_entrypoint_fn, is_expn_of, match_panic_def_id, method_chain_args, return_ty, span_lint, span_lint_and_note,
|
||||
};
|
||||
use crate::utils::{is_entrypoint_fn, is_expn_of, match_panic_def_id, method_chain_args, return_ty};
|
||||
use clippy_utils::diagnostics::{span_lint, span_lint_and_note};
|
||||
use clippy_utils::ty::{implements_trait, is_type_diagnostic_item};
|
||||
use if_chain::if_chain;
|
||||
use itertools::Itertools;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
//! Lint on unnecessary double comparisons. Some examples:
|
||||
|
||||
use clippy_utils::diagnostics::span_lint_and_sugg;
|
||||
use clippy_utils::source::snippet_with_applicability;
|
||||
use rustc_errors::Applicability;
|
||||
use rustc_hir::{BinOpKind, Expr, ExprKind};
|
||||
|
@ -7,7 +8,7 @@ use rustc_lint::{LateContext, LateLintPass};
|
|||
use rustc_session::{declare_lint_pass, declare_tool_lint};
|
||||
use rustc_span::source_map::Span;
|
||||
|
||||
use crate::utils::{eq_expr_value, span_lint_and_sugg};
|
||||
use crate::utils::eq_expr_value;
|
||||
|
||||
declare_clippy_lint! {
|
||||
/// **What it does:** Checks for double comparisons that could be simplified to a single expression.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use crate::utils::span_lint;
|
||||
use clippy_utils::diagnostics::span_lint;
|
||||
use rustc_ast::ast::{Expr, ExprKind};
|
||||
use rustc_lint::{EarlyContext, EarlyLintPass};
|
||||
use rustc_session::{declare_lint_pass, declare_tool_lint};
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use crate::utils::{match_def_path, paths, span_lint_and_note};
|
||||
use crate::utils::{match_def_path, paths};
|
||||
use clippy_utils::diagnostics::span_lint_and_note;
|
||||
use clippy_utils::ty::is_copy;
|
||||
use if_chain::if_chain;
|
||||
use rustc_hir::{Expr, ExprKind};
|
||||
|
|
|
@ -9,7 +9,7 @@ use rustc_span::source_map::Spanned;
|
|||
|
||||
use crate::consts::{constant, Constant};
|
||||
use crate::utils::paths;
|
||||
use crate::utils::span_lint_and_sugg;
|
||||
use clippy_utils::diagnostics::span_lint_and_sugg;
|
||||
|
||||
declare_clippy_lint! {
|
||||
/// **What it does:** Checks for calculation of subsecond microseconds or milliseconds
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
//! Lint on if expressions with an else if, but without a final else branch.
|
||||
|
||||
use clippy_utils::diagnostics::span_lint_and_help;
|
||||
use rustc_ast::ast::{Expr, ExprKind};
|
||||
use rustc_lint::{EarlyContext, EarlyLintPass, LintContext};
|
||||
use rustc_middle::lint::in_external_macro;
|
||||
use rustc_session::{declare_lint_pass, declare_tool_lint};
|
||||
|
||||
use crate::utils::span_lint_and_help;
|
||||
|
||||
declare_clippy_lint! {
|
||||
/// **What it does:** Checks for usage of if expressions with an `else if` branch,
|
||||
/// but without a final `else` branch.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
//! lint when there is an enum with no variants
|
||||
|
||||
use crate::utils::span_lint_and_help;
|
||||
use clippy_utils::diagnostics::span_lint_and_help;
|
||||
use rustc_hir::{Item, ItemKind};
|
||||
use rustc_lint::{LateContext, LateLintPass};
|
||||
use rustc_session::{declare_lint_pass, declare_tool_lint};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use crate::utils::span_lint_and_then;
|
||||
use crate::utils::SpanlessEq;
|
||||
use crate::utils::{get_item_name, paths};
|
||||
use clippy_utils::diagnostics::span_lint_and_then;
|
||||
use clippy_utils::source::{snippet, snippet_opt, snippet_with_applicability};
|
||||
use clippy_utils::ty::{is_type_diagnostic_item, match_type};
|
||||
use if_chain::if_chain;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
//! don't fit into an `i32`
|
||||
|
||||
use crate::consts::{miri_to_const, Constant};
|
||||
use crate::utils::span_lint;
|
||||
use clippy_utils::diagnostics::span_lint;
|
||||
use rustc_hir::{Item, ItemKind};
|
||||
use rustc_lint::{LateContext, LateLintPass};
|
||||
use rustc_middle::ty::util::IntTypeExt;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//! lint on enum variants that are prefixed or suffixed by the same characters
|
||||
|
||||
use crate::utils::camel_case;
|
||||
use crate::utils::{span_lint, span_lint_and_help};
|
||||
use clippy_utils::diagnostics::{span_lint, span_lint_and_help};
|
||||
use clippy_utils::source::is_present_in_source;
|
||||
use rustc_ast::ast::{EnumDef, Item, ItemKind, VisibilityKind};
|
||||
use rustc_lint::{EarlyContext, EarlyLintPass, Lint};
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
use crate::utils::{
|
||||
ast_utils::is_useless_with_eq_exprs, eq_expr_value, higher, in_macro, is_expn_of, multispan_sugg, span_lint,
|
||||
span_lint_and_then,
|
||||
};
|
||||
use crate::utils::{ast_utils::is_useless_with_eq_exprs, eq_expr_value, higher, in_macro, is_expn_of};
|
||||
use clippy_utils::diagnostics::{multispan_sugg, span_lint, span_lint_and_then};
|
||||
use clippy_utils::source::snippet;
|
||||
use clippy_utils::ty::{implements_trait, is_copy};
|
||||
use if_chain::if_chain;
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
use clippy_utils::diagnostics::span_lint;
|
||||
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;
|
||||
|
||||
use crate::consts::{constant_simple, Constant};
|
||||
use crate::utils::span_lint;
|
||||
|
||||
declare_clippy_lint! {
|
||||
/// **What it does:** Checks for erasing operations, e.g., `x * 0`.
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
use clippy_utils::diagnostics::span_lint;
|
||||
use clippy_utils::ty::contains_ty;
|
||||
use rustc_hir::intravisit;
|
||||
use rustc_hir::{self, AssocItemKind, Body, FnDecl, HirId, HirIdSet, Impl, ItemKind, Node};
|
||||
|
@ -11,8 +12,6 @@ use rustc_target::abi::LayoutOf;
|
|||
use rustc_target::spec::abi::Abi;
|
||||
use rustc_typeck::expr_use_visitor::{ConsumeMode, Delegate, ExprUseVisitor, PlaceBase, PlaceWithHirId};
|
||||
|
||||
use crate::utils::span_lint;
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct BoxedLocal {
|
||||
pub too_large_for_stack: u64,
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
use clippy_utils::diagnostics::{span_lint_and_sugg, span_lint_and_then};
|
||||
use clippy_utils::higher;
|
||||
use clippy_utils::higher::VecArgs;
|
||||
use clippy_utils::source::snippet_opt;
|
||||
|
@ -10,7 +11,7 @@ use rustc_middle::lint::in_external_macro;
|
|||
use rustc_middle::ty::{self, Ty};
|
||||
use rustc_session::{declare_lint_pass, declare_tool_lint};
|
||||
|
||||
use crate::utils::{is_adjusted, iter_input_pats, span_lint_and_sugg, span_lint_and_then};
|
||||
use crate::utils::{is_adjusted, iter_input_pats};
|
||||
|
||||
declare_clippy_lint! {
|
||||
/// **What it does:** Checks for closures which just call another function where
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use crate::utils::{get_parent_expr, path_to_local, path_to_local_id, span_lint, span_lint_and_note};
|
||||
use crate::utils::{get_parent_expr, path_to_local, path_to_local_id};
|
||||
use clippy_utils::diagnostics::{span_lint, span_lint_and_note};
|
||||
use rustc_hir::intravisit::{walk_expr, NestedVisitorMap, Visitor};
|
||||
use rustc_hir::{BinOpKind, Block, Expr, ExprKind, Guard, HirId, Local, Node, Stmt, StmtKind};
|
||||
use rustc_lint::{LateContext, LateLintPass};
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use crate::utils::{attr_by_name, in_macro, match_path_ast, span_lint_and_help};
|
||||
use crate::utils::{attr_by_name, in_macro, match_path_ast};
|
||||
use clippy_utils::diagnostics::span_lint_and_help;
|
||||
use rustc_ast::ast::{AssocItemKind, Extern, FnKind, FnSig, ImplKind, Item, ItemKind, TraitKind, Ty, TyKind};
|
||||
use rustc_lint::{EarlyContext, EarlyLintPass};
|
||||
use rustc_session::{declare_tool_lint, impl_lint_pass};
|
||||
|
|
|
@ -1,14 +1,12 @@
|
|||
use clippy_utils::diagnostics::span_lint_and_then;
|
||||
use clippy_utils::source::indent_of;
|
||||
use if_chain::if_chain;
|
||||
|
||||
use rustc_errors::Applicability;
|
||||
use rustc_hir::{Item, ItemKind};
|
||||
use rustc_lint::{LateContext, LateLintPass};
|
||||
use rustc_session::{declare_lint_pass, declare_tool_lint};
|
||||
use rustc_span::sym;
|
||||
|
||||
use crate::utils::span_lint_and_then;
|
||||
|
||||
declare_clippy_lint! {
|
||||
/// **What it does:** Warns on any exported `enum`s that are not tagged `#[non_exhaustive]`
|
||||
///
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use crate::utils::{is_entrypoint_fn, match_def_path, paths, span_lint};
|
||||
use crate::utils::{is_entrypoint_fn, match_def_path, paths};
|
||||
use clippy_utils::diagnostics::span_lint;
|
||||
use if_chain::if_chain;
|
||||
use rustc_hir::{Expr, ExprKind, Item, ItemKind, Node};
|
||||
use rustc_lint::{LateContext, LateLintPass};
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use crate::utils::{is_expn_of, match_function_call, paths, span_lint, span_lint_and_sugg};
|
||||
use crate::utils::{is_expn_of, match_function_call, paths};
|
||||
use clippy_utils::diagnostics::{span_lint, span_lint_and_sugg};
|
||||
use if_chain::if_chain;
|
||||
use rustc_ast::ast::LitKind;
|
||||
use rustc_errors::Applicability;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use crate::utils::{is_expn_of, match_panic_def_id, method_chain_args, span_lint_and_then};
|
||||
use crate::utils::{is_expn_of, match_panic_def_id, method_chain_args};
|
||||
use clippy_utils::diagnostics::span_lint_and_then;
|
||||
use clippy_utils::ty::is_type_diagnostic_item;
|
||||
use if_chain::if_chain;
|
||||
use rustc_hir as hir;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use crate::utils::{match_def_path, paths, span_lint_and_then, sugg};
|
||||
use crate::utils::{match_def_path, paths, sugg};
|
||||
use clippy_utils::diagnostics::span_lint_and_then;
|
||||
use if_chain::if_chain;
|
||||
use rustc_ast::util::parser::AssocOp;
|
||||
use rustc_errors::Applicability;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use crate::utils::{numeric_literal, span_lint_and_sugg};
|
||||
use crate::utils::numeric_literal;
|
||||
use clippy_utils::diagnostics::span_lint_and_sugg;
|
||||
use if_chain::if_chain;
|
||||
use rustc_ast::ast::{self, LitFloatType, LitKind};
|
||||
use rustc_errors::Applicability;
|
||||
|
|
|
@ -2,7 +2,8 @@ use crate::consts::{
|
|||
constant, constant_simple, Constant,
|
||||
Constant::{Int, F32, F64},
|
||||
};
|
||||
use crate::utils::{eq_expr_value, get_parent_expr, numeric_literal, span_lint_and_sugg, sugg};
|
||||
use crate::utils::{eq_expr_value, get_parent_expr, numeric_literal, sugg};
|
||||
use clippy_utils::diagnostics::span_lint_and_sugg;
|
||||
use if_chain::if_chain;
|
||||
use rustc_errors::Applicability;
|
||||
use rustc_hir::{BinOpKind, Expr, ExprKind, PathSegment, UnOp};
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use crate::utils::paths;
|
||||
use crate::utils::{is_expn_of, last_path_segment, match_def_path, match_function_call, span_lint_and_then};
|
||||
use crate::utils::{is_expn_of, last_path_segment, match_def_path, match_function_call};
|
||||
use clippy_utils::diagnostics::span_lint_and_then;
|
||||
use clippy_utils::source::{snippet, snippet_opt};
|
||||
use clippy_utils::ty::is_type_diagnostic_item;
|
||||
use if_chain::if_chain;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use crate::utils::{differing_macro_contexts, span_lint_and_help, span_lint_and_note};
|
||||
use crate::utils::differing_macro_contexts;
|
||||
use clippy_utils::diagnostics::{span_lint_and_help, span_lint_and_note};
|
||||
use clippy_utils::source::snippet_opt;
|
||||
use if_chain::if_chain;
|
||||
use rustc_ast::ast::{BinOpKind, Block, Expr, ExprKind, StmtKind, UnOp};
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use crate::utils::paths::INTO;
|
||||
use crate::utils::{match_def_path, meets_msrv, span_lint_and_help};
|
||||
use crate::utils::{match_def_path, meets_msrv};
|
||||
use clippy_utils::diagnostics::span_lint_and_help;
|
||||
use if_chain::if_chain;
|
||||
use rustc_hir as hir;
|
||||
use rustc_lint::{LateContext, LateLintPass, LintContext};
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
use clippy_utils::diagnostics::span_lint_and_sugg;
|
||||
use clippy_utils::ty::is_type_diagnostic_item;
|
||||
use if_chain::if_chain;
|
||||
use rustc_errors::Applicability;
|
||||
|
@ -7,7 +8,6 @@ use rustc_middle::ty::Ty;
|
|||
use rustc_session::{declare_lint_pass, declare_tool_lint};
|
||||
use rustc_span::symbol::sym;
|
||||
|
||||
use crate::utils::span_lint_and_sugg;
|
||||
use crate::utils::sugg::Sugg;
|
||||
|
||||
declare_clippy_lint! {
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
use crate::utils::{
|
||||
attr_by_name, attrs::is_proc_macro, is_trait_impl_item, iter_input_pats, match_def_path, must_use_attr,
|
||||
path_to_local, return_ty, span_lint, span_lint_and_help, span_lint_and_then, trait_ref_of_method,
|
||||
path_to_local, return_ty, trait_ref_of_method,
|
||||
};
|
||||
use clippy_utils::diagnostics::{span_lint, span_lint_and_help, span_lint_and_then};
|
||||
use clippy_utils::source::{snippet, snippet_opt};
|
||||
use clippy_utils::ty::{is_must_use_ty, is_type_diagnostic_item, type_is_unsafe_function};
|
||||
use if_chain::if_chain;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use crate::utils;
|
||||
use clippy_utils::diagnostics::span_lint_and_then;
|
||||
use rustc_hir::intravisit::FnKind;
|
||||
use rustc_hir::{Body, FnDecl, HirId};
|
||||
use rustc_infer::infer::TyCtxtInferExt;
|
||||
|
@ -84,7 +85,7 @@ impl<'tcx> LateLintPass<'tcx> for FutureNotSend {
|
|||
fulfillment_cx.select_all_or_error(&infcx)
|
||||
});
|
||||
if let Err(send_errors) = send_result {
|
||||
utils::span_lint_and_then(
|
||||
span_lint_and_then(
|
||||
cx,
|
||||
FUTURE_NOT_SEND,
|
||||
span,
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
//! lint on using `x.get(x.len() - 1)` instead of `x.last()`
|
||||
|
||||
use crate::utils::{span_lint_and_sugg, SpanlessEq};
|
||||
use crate::utils::SpanlessEq;
|
||||
use clippy_utils::diagnostics::span_lint_and_sugg;
|
||||
use clippy_utils::source::snippet_with_applicability;
|
||||
use clippy_utils::ty::is_type_diagnostic_item;
|
||||
use if_chain::if_chain;
|
||||
|
|
|
@ -7,7 +7,8 @@ use rustc_session::{declare_lint_pass, declare_tool_lint};
|
|||
use rustc_span::source_map::Span;
|
||||
|
||||
use crate::consts::{constant_simple, Constant};
|
||||
use crate::utils::{clip, span_lint, unsext};
|
||||
use crate::utils::{clip, unsext};
|
||||
use clippy_utils::diagnostics::span_lint;
|
||||
|
||||
declare_clippy_lint! {
|
||||
/// **What it does:** Checks for identity operations, e.g., `x + 0`.
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use crate::utils::{span_lint_and_help, SpanlessEq};
|
||||
use crate::utils::SpanlessEq;
|
||||
use clippy_utils::diagnostics::span_lint_and_help;
|
||||
use clippy_utils::ty::is_type_diagnostic_item;
|
||||
use if_chain::if_chain;
|
||||
use rustc_hir::intravisit::{self as visit, NestedVisitorMap, Visitor};
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use crate::utils::{method_chain_args, span_lint_and_sugg};
|
||||
use crate::utils::method_chain_args;
|
||||
use clippy_utils::diagnostics::span_lint_and_sugg;
|
||||
use clippy_utils::source::snippet_with_applicability;
|
||||
use clippy_utils::ty::is_type_diagnostic_item;
|
||||
use if_chain::if_chain;
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
//! lint on if branches that could be swapped so no `!` operation is necessary
|
||||
//! on the condition
|
||||
|
||||
use clippy_utils::diagnostics::span_lint_and_help;
|
||||
use rustc_ast::ast::{BinOpKind, Expr, ExprKind, UnOp};
|
||||
use rustc_lint::{EarlyContext, EarlyLintPass, LintContext};
|
||||
use rustc_middle::lint::in_external_macro;
|
||||
use rustc_session::{declare_lint_pass, declare_tool_lint};
|
||||
|
||||
use crate::utils::span_lint_and_help;
|
||||
|
||||
declare_clippy_lint! {
|
||||
/// **What it does:** Checks for usage of `!` or `!=` in an if condition with an
|
||||
/// else branch.
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use crate::utils;
|
||||
use clippy_utils::diagnostics::span_lint_and_help;
|
||||
use clippy_utils::source::snippet_with_macro_callsite;
|
||||
use if_chain::if_chain;
|
||||
use rustc_hir::{Expr, ExprKind};
|
||||
|
@ -100,7 +101,7 @@ impl LateLintPass<'_> for IfThenSomeElseNone {
|
|||
cond_snip,
|
||||
closure_body,
|
||||
);
|
||||
utils::span_lint_and_help(
|
||||
span_lint_and_help(
|
||||
cx,
|
||||
IF_THEN_SOME_ELSE_NONE,
|
||||
expr.span,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use crate::utils::{match_panic_def_id, span_lint_and_then};
|
||||
use crate::utils::match_panic_def_id;
|
||||
use clippy_utils::diagnostics::span_lint_and_then;
|
||||
use clippy_utils::source::snippet_opt;
|
||||
use if_chain::if_chain;
|
||||
use rustc_errors::Applicability;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use crate::utils::{in_macro, match_qpath, span_lint_and_sugg, SpanlessEq};
|
||||
use crate::utils::{in_macro, match_qpath, SpanlessEq};
|
||||
use clippy_utils::diagnostics::span_lint_and_sugg;
|
||||
use if_chain::if_chain;
|
||||
use rustc_ast::ast::LitKind;
|
||||
use rustc_errors::Applicability;
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
use clippy_utils::diagnostics::span_lint_and_sugg;
|
||||
use clippy_utils::source::snippet;
|
||||
use if_chain::if_chain;
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
|
@ -7,8 +8,6 @@ use rustc_lint::{LateContext, LateLintPass};
|
|||
use rustc_session::{declare_lint_pass, declare_tool_lint};
|
||||
use rustc_span::symbol::Symbol;
|
||||
|
||||
use crate::utils::span_lint_and_sugg;
|
||||
|
||||
declare_clippy_lint! {
|
||||
/// **What it does:** Checks for struct constructors where all fields are shorthand and
|
||||
/// the order of the field init shorthand in the constructor is inconsistent
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
//! lint on indexing and slicing operations
|
||||
|
||||
use crate::consts::{constant, Constant};
|
||||
use crate::utils::{higher, span_lint, span_lint_and_help};
|
||||
use crate::utils::higher;
|
||||
use clippy_utils::diagnostics::{span_lint, span_lint_and_help};
|
||||
use rustc_ast::ast::RangeLimits;
|
||||
use rustc_hir::{Expr, ExprKind};
|
||||
use rustc_lint::{LateContext, LateLintPass};
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
use clippy_utils::diagnostics::span_lint;
|
||||
use clippy_utils::ty::{implements_trait, match_type};
|
||||
use rustc_hir::{BorrowKind, Expr, ExprKind};
|
||||
use rustc_lint::{LateContext, LateLintPass};
|
||||
use rustc_session::{declare_lint_pass, declare_tool_lint};
|
||||
|
||||
use crate::utils::{get_trait_def_id, higher, match_qpath, paths, span_lint};
|
||||
use crate::utils::{get_trait_def_id, higher, match_qpath, paths};
|
||||
|
||||
declare_clippy_lint! {
|
||||
/// **What it does:** Checks for iteration that is guaranteed to be infinite.
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
//! lint on inherent implementations
|
||||
|
||||
use crate::utils::{in_macro, span_lint_and_then};
|
||||
use crate::utils::in_macro;
|
||||
use clippy_utils::diagnostics::span_lint_and_then;
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_hir::{def_id, Crate, Impl, Item, ItemKind};
|
||||
use rustc_lint::{LateContext, LateLintPass};
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
use clippy_utils::diagnostics::span_lint_and_help;
|
||||
use clippy_utils::ty::{implements_trait, is_type_diagnostic_item};
|
||||
use if_chain::if_chain;
|
||||
use rustc_hir::{ImplItem, ImplItemKind};
|
||||
|
@ -5,7 +6,7 @@ use rustc_lint::{LateContext, LateLintPass};
|
|||
use rustc_session::{declare_lint_pass, declare_tool_lint};
|
||||
use rustc_span::sym;
|
||||
|
||||
use crate::utils::{get_trait_def_id, paths, return_ty, span_lint_and_help, trait_ref_of_method};
|
||||
use crate::utils::{get_trait_def_id, paths, return_ty, trait_ref_of_method};
|
||||
|
||||
declare_clippy_lint! {
|
||||
/// **What it does:** Checks for the definition of inherent methods with a signature of `to_string(&self) -> String`.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//! checks for `#[inline]` on trait methods without bodies
|
||||
|
||||
use crate::utils::span_lint_and_then;
|
||||
use crate::utils::sugg::DiagnosticBuilderExt;
|
||||
use clippy_utils::diagnostics::span_lint_and_then;
|
||||
use rustc_ast::ast::Attribute;
|
||||
use rustc_errors::Applicability;
|
||||
use rustc_hir::{TraitFn, TraitItem, TraitItemKind};
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
//! lint on blocks unnecessarily using >= with a + 1 or - 1
|
||||
|
||||
use clippy_utils::diagnostics::span_lint_and_sugg;
|
||||
use clippy_utils::source::snippet_opt;
|
||||
use rustc_ast::ast::{BinOpKind, Expr, ExprKind, Lit, LitKind};
|
||||
use rustc_errors::Applicability;
|
||||
use rustc_lint::{EarlyContext, EarlyLintPass};
|
||||
use rustc_session::{declare_lint_pass, declare_tool_lint};
|
||||
|
||||
use crate::utils::span_lint_and_sugg;
|
||||
|
||||
declare_clippy_lint! {
|
||||
/// **What it does:** Checks for usage of `x >= y + 1` or `x - 1 >= y` (and `<=`) in a block
|
||||
///
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use crate::utils::span_lint_and_help;
|
||||
use clippy_utils::diagnostics::span_lint_and_help;
|
||||
use if_chain::if_chain;
|
||||
use rustc_hir as hir;
|
||||
use rustc_lint::{LateContext, LateLintPass};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
//! lint when items are used after statements
|
||||
|
||||
use crate::utils::span_lint;
|
||||
use clippy_utils::diagnostics::span_lint;
|
||||
use rustc_ast::ast::{Block, ItemKind, StmtKind};
|
||||
use rustc_lint::{EarlyContext, EarlyLintPass, LintContext};
|
||||
use rustc_middle::lint::in_external_macro;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use crate::rustc_target::abi::LayoutOf;
|
||||
use crate::utils::span_lint_and_then;
|
||||
use clippy_utils::diagnostics::span_lint_and_then;
|
||||
use if_chain::if_chain;
|
||||
use rustc_errors::Applicability;
|
||||
use rustc_hir::{Item, ItemKind};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
//! lint when there is a large size difference between variants on an enum
|
||||
|
||||
use crate::utils::span_lint_and_then;
|
||||
use clippy_utils::diagnostics::span_lint_and_then;
|
||||
use clippy_utils::source::snippet_opt;
|
||||
use rustc_errors::Applicability;
|
||||
use rustc_hir::{Item, ItemKind, VariantData};
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
use clippy_utils::diagnostics::span_lint_and_help;
|
||||
use clippy_utils::source::snippet;
|
||||
use if_chain::if_chain;
|
||||
use rustc_hir::{Expr, ExprKind};
|
||||
|
@ -7,7 +8,6 @@ use rustc_middle::ty::{self, ConstKind};
|
|||
use rustc_session::{declare_tool_lint, impl_lint_pass};
|
||||
|
||||
use crate::rustc_target::abi::LayoutOf;
|
||||
use crate::utils::span_lint_and_help;
|
||||
|
||||
declare_clippy_lint! {
|
||||
/// **What it does:** Checks for local arrays that may be too large.
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use crate::utils::{get_item_name, get_parent_as_impl, is_allowed, span_lint, span_lint_and_sugg, span_lint_and_then};
|
||||
use crate::utils::{get_item_name, get_parent_as_impl, is_allowed};
|
||||
use clippy_utils::diagnostics::{span_lint, span_lint_and_sugg, span_lint_and_then};
|
||||
use clippy_utils::source::snippet_with_applicability;
|
||||
use if_chain::if_chain;
|
||||
use rustc_ast::ast::LitKind;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use crate::utils::{path_to_local_id, span_lint_and_then, visitors::LocalUsedVisitor};
|
||||
use crate::utils::{path_to_local_id, visitors::LocalUsedVisitor};
|
||||
use clippy_utils::diagnostics::span_lint_and_then;
|
||||
use clippy_utils::source::snippet;
|
||||
use if_chain::if_chain;
|
||||
use rustc_errors::Applicability;
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
use clippy_utils::diagnostics::span_lint_and_help;
|
||||
use clippy_utils::ty::{is_must_use_ty, match_type};
|
||||
use if_chain::if_chain;
|
||||
use rustc_hir::{Local, PatKind};
|
||||
|
@ -6,7 +7,7 @@ use rustc_middle::lint::in_external_macro;
|
|||
use rustc_middle::ty::subst::GenericArgKind;
|
||||
use rustc_session::{declare_lint_pass, declare_tool_lint};
|
||||
|
||||
use crate::utils::{is_must_use_func_call, paths, span_lint_and_help};
|
||||
use crate::utils::{is_must_use_func_call, paths};
|
||||
|
||||
declare_clippy_lint! {
|
||||
/// **What it does:** Checks for `let _ = <expr>`
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use crate::utils::{in_macro, span_lint, trait_ref_of_method};
|
||||
use crate::utils::{in_macro, trait_ref_of_method};
|
||||
use clippy_utils::diagnostics::span_lint;
|
||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||
use rustc_hir::intravisit::{
|
||||
walk_fn_decl, walk_generic_param, walk_generics, walk_item, walk_param_bound, walk_poly_trait_ref, walk_ty,
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
use crate::utils::{
|
||||
in_macro,
|
||||
numeric_literal::{NumericLiteral, Radix},
|
||||
span_lint_and_sugg,
|
||||
};
|
||||
use clippy_utils::diagnostics::span_lint_and_sugg;
|
||||
use clippy_utils::source::snippet_opt;
|
||||
use if_chain::if_chain;
|
||||
use rustc_ast::ast::{Expr, ExprKind, Lit, LitKind};
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use super::EMPTY_LOOP;
|
||||
use crate::utils::{is_in_panic_handler, is_no_std_crate, span_lint_and_help};
|
||||
use crate::utils::{is_in_panic_handler, is_no_std_crate};
|
||||
use clippy_utils::diagnostics::span_lint_and_help;
|
||||
|
||||
use rustc_hir::{Block, Expr};
|
||||
use rustc_lint::LateContext;
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
use super::{
|
||||
get_span_of_entire_for_loop, make_iterator_snippet, IncrementVisitor, InitializeVisitor, EXPLICIT_COUNTER_LOOP,
|
||||
};
|
||||
use crate::utils::{get_enclosing_block, is_integer_const, span_lint_and_sugg};
|
||||
use crate::utils::{get_enclosing_block, is_integer_const};
|
||||
use clippy_utils::diagnostics::span_lint_and_sugg;
|
||||
use clippy_utils::source::snippet_with_applicability;
|
||||
use if_chain::if_chain;
|
||||
use rustc_errors::Applicability;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use super::EXPLICIT_INTO_ITER_LOOP;
|
||||
use crate::utils::span_lint_and_sugg;
|
||||
use clippy_utils::diagnostics::span_lint_and_sugg;
|
||||
use clippy_utils::source::snippet_with_applicability;
|
||||
use rustc_errors::Applicability;
|
||||
use rustc_hir::Expr;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue