Skip to content

Commit

Permalink
Auto merge of rust-lang#6916 - camsteffen:diagnostics-util, r=Manishe…
Browse files Browse the repository at this point in the history
…arth

Don't re-export `clippy_utils::diagnostics::*`

changelog: none

Continues rust-lang#6907
  • Loading branch information
bors committed Mar 16, 2021
2 parents d7a2311 + 1c3a3e7 commit 99ecb61
Show file tree
Hide file tree
Showing 307 changed files with 530 additions and 368 deletions.
2 changes: 1 addition & 1 deletion clippy_lints/src/approx_const.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/arithmetic.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down
3 changes: 1 addition & 2 deletions clippy_lints/src/as_conversions.rs
Original file line number Diff line number Diff line change
@@ -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.
///
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/asm_syntax.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down
3 changes: 2 additions & 1 deletion clippy_lints/src/assertions_on_constants.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down
3 changes: 2 additions & 1 deletion clippy_lints/src/assign_ops.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/async_yields_async.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
3 changes: 2 additions & 1 deletion clippy_lints/src/atomic_ordering.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down
3 changes: 2 additions & 1 deletion clippy_lints/src/attrs.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down
3 changes: 2 additions & 1 deletion clippy_lints/src/await_holding_invalid.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/bit_mask.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/blacklisted_name.rs
Original file line number Diff line number Diff line change
@@ -1,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};
Expand Down
3 changes: 2 additions & 1 deletion clippy_lints/src/blocks_in_if_conditions.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
3 changes: 2 additions & 1 deletion clippy_lints/src/booleans.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
3 changes: 2 additions & 1 deletion clippy_lints/src/bytecount.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
3 changes: 2 additions & 1 deletion clippy_lints/src/cargo_common_metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
Original file line number Diff line number Diff line change
@@ -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};
Expand Down
3 changes: 2 additions & 1 deletion clippy_lints/src/casts/cast_lossless.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
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;
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};

Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/casts/cast_possible_truncation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down
3 changes: 1 addition & 2 deletions clippy_lints/src/casts/cast_possible_wrap.rs
Original file line number Diff line number Diff line change
@@ -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<'_>) {
Expand Down
3 changes: 1 addition & 2 deletions clippy_lints/src/casts/cast_precision_loss.rs
Original file line number Diff line number Diff line change
@@ -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<'_>) {
Expand Down
3 changes: 2 additions & 1 deletion clippy_lints/src/casts/cast_ptr_alignment.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand All @@ -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;

Expand Down
6 changes: 2 additions & 4 deletions clippy_lints/src/casts/cast_ref_to_mut.rs
Original file line number Diff line number Diff line change
@@ -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<'_>) {
Expand Down
3 changes: 2 additions & 1 deletion clippy_lints/src/casts/cast_sign_loss.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
3 changes: 1 addition & 2 deletions clippy_lints/src/casts/char_lit_as_u8.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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<'_>) {
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/casts/fn_to_numeric_cast.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
3 changes: 2 additions & 1 deletion clippy_lints/src/casts/ptr_as_ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
3 changes: 2 additions & 1 deletion clippy_lints/src/casts/unnecessary_cast.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand All @@ -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;

Expand Down
3 changes: 2 additions & 1 deletion clippy_lints/src/checked_conversions.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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);

Expand Down
3 changes: 2 additions & 1 deletion clippy_lints/src/cognitive_complexity.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/collapsible_if.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down
3 changes: 2 additions & 1 deletion clippy_lints/src/collapsible_match.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down
3 changes: 2 additions & 1 deletion clippy_lints/src/comparison_chain.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down
3 changes: 2 additions & 1 deletion clippy_lints/src/copies.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/copy_iterator.rs
Original file line number Diff line number Diff line change
@@ -1,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};
Expand Down
3 changes: 2 additions & 1 deletion clippy_lints/src/create_dir.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/dbg_macro.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/default.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
3 changes: 1 addition & 2 deletions clippy_lints/src/default_numeric_fallback.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand All @@ -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.
Expand Down
3 changes: 2 additions & 1 deletion clippy_lints/src/dereference.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
6 changes: 2 additions & 4 deletions clippy_lints/src/derive.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Loading

0 comments on commit 99ecb61

Please sign in to comment.