Reformat use
declarations.
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
This commit is contained in:
parent
118f9350c5
commit
84ac80f192
1865 changed files with 8367 additions and 9199 deletions
|
@ -1,10 +1,10 @@
|
|||
use crate::lints::AsyncFnInTraitDiag;
|
||||
use crate::LateContext;
|
||||
use crate::LateLintPass;
|
||||
use rustc_hir as hir;
|
||||
use rustc_session::{declare_lint, declare_lint_pass};
|
||||
use rustc_trait_selection::error_reporting::traits::suggestions::suggest_desugaring_async_fn_to_impl_future_in_trait;
|
||||
|
||||
use crate::lints::AsyncFnInTraitDiag;
|
||||
use crate::{LateContext, LateLintPass};
|
||||
|
||||
declare_lint! {
|
||||
/// The `async_fn_in_trait` lint detects use of `async fn` in the
|
||||
/// definition of a publicly-reachable trait.
|
||||
|
|
|
@ -20,25 +20,8 @@
|
|||
//! If you define a new `LateLintPass`, you will also need to add it to the
|
||||
//! `late_lint_methods!` invocation in `lib.rs`.
|
||||
|
||||
use crate::fluent_generated as fluent;
|
||||
use crate::{
|
||||
errors::BuiltinEllipsisInclusiveRangePatterns,
|
||||
lints::{
|
||||
BuiltinAnonymousParams, BuiltinConstNoMangle, BuiltinDeprecatedAttrLink,
|
||||
BuiltinDeprecatedAttrLinkSuggestion, BuiltinDeprecatedAttrUsed, BuiltinDerefNullptr,
|
||||
BuiltinEllipsisInclusiveRangePatternsLint, BuiltinExplicitOutlives,
|
||||
BuiltinExplicitOutlivesSuggestion, BuiltinFeatureIssueNote, BuiltinIncompleteFeatures,
|
||||
BuiltinIncompleteFeaturesHelp, BuiltinInternalFeatures, BuiltinKeywordIdents,
|
||||
BuiltinMissingCopyImpl, BuiltinMissingDebugImpl, BuiltinMissingDoc,
|
||||
BuiltinMutablesTransmutes, BuiltinNoMangleGeneric, BuiltinNonShorthandFieldPatterns,
|
||||
BuiltinSpecialModuleNameUsed, BuiltinTrivialBounds, BuiltinTypeAliasBounds,
|
||||
BuiltinUngatedAsyncFnTrackCaller, BuiltinUnpermittedTypeInit,
|
||||
BuiltinUnpermittedTypeInitSub, BuiltinUnreachablePub, BuiltinUnsafe,
|
||||
BuiltinUnstableFeatures, BuiltinUnusedDocComment, BuiltinUnusedDocCommentSub,
|
||||
BuiltinWhileTrue, InvalidAsmLabel,
|
||||
},
|
||||
EarlyContext, EarlyLintPass, LateContext, LateLintPass, Level, LintContext,
|
||||
};
|
||||
use std::fmt::Write;
|
||||
|
||||
use ast::token::TokenKind;
|
||||
use rustc_ast::tokenstream::{TokenStream, TokenTree};
|
||||
use rustc_ast::visit::{FnCtxt, FnKind};
|
||||
|
@ -55,9 +38,9 @@ use rustc_middle::bug;
|
|||
use rustc_middle::lint::in_external_macro;
|
||||
use rustc_middle::ty::layout::LayoutOf;
|
||||
use rustc_middle::ty::print::with_no_trimmed_paths;
|
||||
use rustc_middle::ty::TypeVisitableExt;
|
||||
use rustc_middle::ty::Upcast;
|
||||
use rustc_middle::ty::{self, Ty, TyCtxt, VariantDef};
|
||||
use rustc_middle::ty::{self, Ty, TyCtxt, TypeVisitableExt, Upcast, VariantDef};
|
||||
// hardwired lints from rustc_lint_defs
|
||||
pub use rustc_session::lint::builtin::*;
|
||||
use rustc_session::lint::FutureIncompatibilityReason;
|
||||
use rustc_session::{declare_lint, declare_lint_pass, impl_lint_pass};
|
||||
use rustc_span::edition::Edition;
|
||||
|
@ -67,15 +50,29 @@ use rustc_span::{BytePos, InnerSpan, Span};
|
|||
use rustc_target::abi::Abi;
|
||||
use rustc_target::asm::InlineAsmArch;
|
||||
use rustc_trait_selection::infer::{InferCtxtExt, TyCtxtInferExt};
|
||||
use rustc_trait_selection::traits::misc::type_allowed_to_implement_copy;
|
||||
use rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt as _;
|
||||
use rustc_trait_selection::traits::{self, misc::type_allowed_to_implement_copy};
|
||||
use rustc_trait_selection::traits::{self};
|
||||
|
||||
use crate::errors::BuiltinEllipsisInclusiveRangePatterns;
|
||||
use crate::lints::{
|
||||
BuiltinAnonymousParams, BuiltinConstNoMangle, BuiltinDeprecatedAttrLink,
|
||||
BuiltinDeprecatedAttrLinkSuggestion, BuiltinDeprecatedAttrUsed, BuiltinDerefNullptr,
|
||||
BuiltinEllipsisInclusiveRangePatternsLint, BuiltinExplicitOutlives,
|
||||
BuiltinExplicitOutlivesSuggestion, BuiltinFeatureIssueNote, BuiltinIncompleteFeatures,
|
||||
BuiltinIncompleteFeaturesHelp, BuiltinInternalFeatures, BuiltinKeywordIdents,
|
||||
BuiltinMissingCopyImpl, BuiltinMissingDebugImpl, BuiltinMissingDoc, BuiltinMutablesTransmutes,
|
||||
BuiltinNoMangleGeneric, BuiltinNonShorthandFieldPatterns, BuiltinSpecialModuleNameUsed,
|
||||
BuiltinTrivialBounds, BuiltinTypeAliasBounds, BuiltinUngatedAsyncFnTrackCaller,
|
||||
BuiltinUnpermittedTypeInit, BuiltinUnpermittedTypeInitSub, BuiltinUnreachablePub,
|
||||
BuiltinUnsafe, BuiltinUnstableFeatures, BuiltinUnusedDocComment, BuiltinUnusedDocCommentSub,
|
||||
BuiltinWhileTrue, InvalidAsmLabel,
|
||||
};
|
||||
use crate::nonstandard_style::{method_context, MethodLateContext};
|
||||
|
||||
use std::fmt::Write;
|
||||
|
||||
// hardwired lints from rustc_lint_defs
|
||||
pub use rustc_session::lint::builtin::*;
|
||||
use crate::{
|
||||
fluent_generated as fluent, EarlyContext, EarlyLintPass, LateContext, LateLintPass, Level,
|
||||
LintContext,
|
||||
};
|
||||
|
||||
declare_lint! {
|
||||
/// The `while_true` lint detects `while true { }`.
|
||||
|
@ -1672,7 +1669,8 @@ impl EarlyLintPass for EllipsisInclusiveRangePatterns {
|
|||
return;
|
||||
}
|
||||
|
||||
use self::ast::{PatKind, RangeSyntax::DotDotDot};
|
||||
use self::ast::PatKind;
|
||||
use self::ast::RangeSyntax::DotDotDot;
|
||||
|
||||
/// If `pat` is a `...` pattern, return the start and end of the range, as well as the span
|
||||
/// corresponding to the ellipsis.
|
||||
|
|
|
@ -14,10 +14,9 @@
|
|||
//! upon. As the ast is traversed, this keeps track of the current lint level
|
||||
//! for all lint attributes.
|
||||
|
||||
use self::TargetLint::*;
|
||||
use std::cell::Cell;
|
||||
use std::{iter, slice};
|
||||
|
||||
use crate::levels::LintLevelsBuilder;
|
||||
use crate::passes::{EarlyLintPassObject, LateLintPassObject};
|
||||
use rustc_data_structures::fx::FxIndexMap;
|
||||
use rustc_data_structures::sync;
|
||||
use rustc_data_structures::unord::UnordMap;
|
||||
|
@ -30,20 +29,22 @@ use rustc_hir::definitions::{DefPathData, DisambiguatedDefPathData};
|
|||
use rustc_middle::bug;
|
||||
use rustc_middle::middle::privacy::EffectiveVisibilities;
|
||||
use rustc_middle::ty::layout::{LayoutError, LayoutOfHelpers, TyAndLayout};
|
||||
use rustc_middle::ty::print::{with_no_trimmed_paths, PrintError, PrintTraitRefExt as _};
|
||||
use rustc_middle::ty::{self, print::Printer, GenericArg, RegisteredTools, Ty, TyCtxt};
|
||||
use rustc_session::lint::{BuiltinLintDiag, LintExpectationId};
|
||||
use rustc_session::lint::{FutureIncompatibleInfo, Level, Lint, LintBuffer, LintId};
|
||||
use rustc_middle::ty::print::{with_no_trimmed_paths, PrintError, PrintTraitRefExt as _, Printer};
|
||||
use rustc_middle::ty::{self, GenericArg, RegisteredTools, Ty, TyCtxt};
|
||||
use rustc_session::lint::{
|
||||
BuiltinLintDiag, FutureIncompatibleInfo, Level, Lint, LintBuffer, LintExpectationId, LintId,
|
||||
};
|
||||
use rustc_session::{LintStoreMarker, Session};
|
||||
use rustc_span::edit_distance::find_best_match_for_names;
|
||||
use rustc_span::symbol::{sym, Ident, Symbol};
|
||||
use rustc_span::Span;
|
||||
use rustc_target::abi;
|
||||
use std::cell::Cell;
|
||||
use std::iter;
|
||||
use std::slice;
|
||||
use tracing::debug;
|
||||
|
||||
use self::TargetLint::*;
|
||||
use crate::levels::LintLevelsBuilder;
|
||||
use crate::passes::{EarlyLintPassObject, LateLintPassObject};
|
||||
|
||||
mod diagnostics;
|
||||
|
||||
type EarlyLintPassFactory = dyn Fn() -> EarlyLintPassObject + sync::DynSend + sync::DynSync;
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
use std::borrow::Cow;
|
||||
|
||||
use rustc_ast::util::unicode::TEXT_FLOW_CONTROL_CHARS;
|
||||
use rustc_errors::elided_lifetime_in_path_suggestion;
|
||||
use rustc_errors::{Applicability, Diag, DiagArgValue, LintDiagnostic};
|
||||
use rustc_errors::{
|
||||
elided_lifetime_in_path_suggestion, Applicability, Diag, DiagArgValue, LintDiagnostic,
|
||||
};
|
||||
use rustc_middle::middle::stability;
|
||||
use rustc_session::lint::BuiltinLintDiag;
|
||||
use rustc_session::Session;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use rustc_middle::bug;
|
||||
use rustc_session::{config::ExpectedValues, Session};
|
||||
use rustc_session::config::ExpectedValues;
|
||||
use rustc_session::Session;
|
||||
use rustc_span::edit_distance::find_best_match_for_name;
|
||||
use rustc_span::{sym, Span, Symbol};
|
||||
|
||||
|
|
|
@ -1,8 +1,3 @@
|
|||
use crate::{
|
||||
lints::{SupertraitAsDerefTarget, SupertraitAsDerefTargetLabel},
|
||||
LateContext, LateLintPass, LintContext,
|
||||
};
|
||||
|
||||
use rustc_hir::{self as hir, LangItem};
|
||||
use rustc_middle::ty;
|
||||
use rustc_session::lint::FutureIncompatibilityReason;
|
||||
|
@ -10,6 +5,9 @@ use rustc_session::{declare_lint, declare_lint_pass};
|
|||
use rustc_span::sym;
|
||||
use rustc_trait_selection::traits::supertraits;
|
||||
|
||||
use crate::lints::{SupertraitAsDerefTarget, SupertraitAsDerefTargetLabel};
|
||||
use crate::{LateContext, LateLintPass, LintContext};
|
||||
|
||||
declare_lint! {
|
||||
/// The `deref_into_dyn_supertrait` lint is output whenever there is a use of the
|
||||
/// `Deref` implementation with a `dyn SuperTrait` type as `Output`.
|
||||
|
|
|
@ -3,13 +3,11 @@ use rustc_middle::ty;
|
|||
use rustc_session::{declare_lint, declare_lint_pass};
|
||||
use rustc_span::sym;
|
||||
|
||||
use crate::{
|
||||
lints::{
|
||||
DropCopyDiag, DropRefDiag, ForgetCopyDiag, ForgetRefDiag, UndroppedManuallyDropsDiag,
|
||||
UndroppedManuallyDropsSuggestion, UseLetUnderscoreIgnoreSuggestion,
|
||||
},
|
||||
LateContext, LateLintPass, LintContext,
|
||||
use crate::lints::{
|
||||
DropCopyDiag, DropRefDiag, ForgetCopyDiag, ForgetRefDiag, UndroppedManuallyDropsDiag,
|
||||
UndroppedManuallyDropsSuggestion, UseLetUnderscoreIgnoreSuggestion,
|
||||
};
|
||||
use crate::{LateContext, LateLintPass, LintContext};
|
||||
|
||||
declare_lint! {
|
||||
/// The `dropping_references` lint checks for calls to `std::mem::drop` with a reference
|
||||
|
|
|
@ -14,8 +14,6 @@
|
|||
//! upon. As the ast is traversed, this keeps track of the current lint level
|
||||
//! for all lint attributes.
|
||||
|
||||
use crate::context::{EarlyContext, LintStore};
|
||||
use crate::passes::{EarlyLintPass, EarlyLintPassObject};
|
||||
use rustc_ast::ptr::P;
|
||||
use rustc_ast::visit::{self as ast_visit, walk_list, Visitor};
|
||||
use rustc_ast::{self as ast, HasAttrs};
|
||||
|
@ -28,6 +26,9 @@ use rustc_span::symbol::Ident;
|
|||
use rustc_span::Span;
|
||||
use tracing::debug;
|
||||
|
||||
use crate::context::{EarlyContext, LintStore};
|
||||
use crate::passes::{EarlyLintPass, EarlyLintPassObject};
|
||||
|
||||
macro_rules! lint_callback { ($cx:expr, $f:ident, $($args:expr),*) => ({
|
||||
$cx.pass.$f(&$cx.context, $($args),*);
|
||||
}) }
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
use crate::{
|
||||
context::LintContext,
|
||||
lints::{EnumIntrinsicsMemDiscriminate, EnumIntrinsicsMemVariant},
|
||||
LateContext, LateLintPass,
|
||||
};
|
||||
use rustc_hir as hir;
|
||||
use rustc_middle::ty::{visit::TypeVisitableExt, Ty};
|
||||
use rustc_middle::ty::visit::TypeVisitableExt;
|
||||
use rustc_middle::ty::Ty;
|
||||
use rustc_session::{declare_lint, declare_lint_pass};
|
||||
use rustc_span::{symbol::sym, Span};
|
||||
use rustc_span::symbol::sym;
|
||||
use rustc_span::Span;
|
||||
|
||||
use crate::context::LintContext;
|
||||
use crate::lints::{EnumIntrinsicsMemDiscriminate, EnumIntrinsicsMemVariant};
|
||||
use crate::{LateContext, LateLintPass};
|
||||
|
||||
declare_lint! {
|
||||
/// The `enum_intrinsics_non_enums` lint detects calls to
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
use crate::fluent_generated as fluent;
|
||||
use rustc_errors::{codes::*, Diag, EmissionGuarantee, SubdiagMessageOp, Subdiagnostic};
|
||||
use rustc_errors::codes::*;
|
||||
use rustc_errors::{Diag, EmissionGuarantee, SubdiagMessageOp, Subdiagnostic};
|
||||
use rustc_macros::{Diagnostic, Subdiagnostic};
|
||||
use rustc_session::lint::Level;
|
||||
use rustc_span::{Span, Symbol};
|
||||
|
||||
use crate::fluent_generated as fluent;
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(lint_overruled_attribute, code = E0453)]
|
||||
pub struct OverruledAttribute<'a> {
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
use crate::lints::{Expectation, ExpectationNote};
|
||||
use rustc_middle::query::Providers;
|
||||
use rustc_middle::ty::TyCtxt;
|
||||
use rustc_session::lint::builtin::UNFULFILLED_LINT_EXPECTATIONS;
|
||||
use rustc_session::lint::LintExpectationId;
|
||||
use rustc_span::Symbol;
|
||||
|
||||
use crate::lints::{Expectation, ExpectationNote};
|
||||
|
||||
pub(crate) fn provide(providers: &mut Providers) {
|
||||
*providers = Providers { check_expectations, ..*providers };
|
||||
}
|
||||
|
|
|
@ -1,19 +1,18 @@
|
|||
use crate::{
|
||||
lints::{
|
||||
ForLoopsOverFalliblesDiag, ForLoopsOverFalliblesLoopSub, ForLoopsOverFalliblesQuestionMark,
|
||||
ForLoopsOverFalliblesSuggestion,
|
||||
},
|
||||
LateContext, LateLintPass, LintContext,
|
||||
};
|
||||
|
||||
use hir::{Expr, Pat};
|
||||
use rustc_hir as hir;
|
||||
use rustc_infer::{infer::TyCtxtInferExt, traits::ObligationCause};
|
||||
use rustc_infer::infer::TyCtxtInferExt;
|
||||
use rustc_infer::traits::ObligationCause;
|
||||
use rustc_middle::ty;
|
||||
use rustc_session::{declare_lint, declare_lint_pass};
|
||||
use rustc_span::{sym, Span};
|
||||
use rustc_trait_selection::traits::ObligationCtxt;
|
||||
|
||||
use crate::lints::{
|
||||
ForLoopsOverFalliblesDiag, ForLoopsOverFalliblesLoopSub, ForLoopsOverFalliblesQuestionMark,
|
||||
ForLoopsOverFalliblesSuggestion,
|
||||
};
|
||||
use crate::{LateContext, LateLintPass, LintContext};
|
||||
|
||||
declare_lint! {
|
||||
/// The `for_loops_over_fallibles` lint checks for `for` loops over `Option` or `Result` values.
|
||||
///
|
||||
|
|
|
@ -1,15 +1,13 @@
|
|||
use crate::{
|
||||
lints::{
|
||||
HiddenUnicodeCodepointsDiag, HiddenUnicodeCodepointsDiagLabels,
|
||||
HiddenUnicodeCodepointsDiagSub,
|
||||
},
|
||||
EarlyContext, EarlyLintPass, LintContext,
|
||||
};
|
||||
use ast::util::unicode::{contains_text_flow_control_chars, TEXT_FLOW_CONTROL_CHARS};
|
||||
use rustc_ast as ast;
|
||||
use rustc_session::{declare_lint, declare_lint_pass};
|
||||
use rustc_span::{BytePos, Span, Symbol};
|
||||
|
||||
use crate::lints::{
|
||||
HiddenUnicodeCodepointsDiag, HiddenUnicodeCodepointsDiagLabels, HiddenUnicodeCodepointsDiagSub,
|
||||
};
|
||||
use crate::{EarlyContext, EarlyLintPass, LintContext};
|
||||
|
||||
declare_lint! {
|
||||
/// The `text_direction_codepoint_in_literal` lint detects Unicode codepoints that change the
|
||||
/// visual representation of text on screen in a way that does not correspond to their on
|
||||
|
|
|
@ -13,8 +13,7 @@ use rustc_middle::ty::{
|
|||
use rustc_session::{declare_lint, declare_lint_pass};
|
||||
use rustc_span::Span;
|
||||
|
||||
use crate::fluent_generated as fluent;
|
||||
use crate::{LateContext, LateLintPass};
|
||||
use crate::{fluent_generated as fluent, LateContext, LateLintPass};
|
||||
|
||||
declare_lint! {
|
||||
/// The `impl_trait_overcaptures` lint warns against cases where lifetime
|
||||
|
|
|
@ -1,22 +1,26 @@
|
|||
//! Some lints that are only useful in the compiler or crates that use compiler internals, such as
|
||||
//! Clippy.
|
||||
|
||||
use rustc_ast as ast;
|
||||
use rustc_hir::def::Res;
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_hir::{
|
||||
BinOp, BinOpKind, Expr, ExprKind, GenericArg, HirId, Impl, Item, ItemKind, Node, Pat, PatKind,
|
||||
Path, PathSegment, QPath, Ty, TyKind,
|
||||
};
|
||||
use rustc_middle::ty::{self, Ty as MiddleTy};
|
||||
use rustc_session::{declare_lint_pass, declare_tool_lint};
|
||||
use rustc_span::hygiene::{ExpnKind, MacroKind};
|
||||
use rustc_span::symbol::{kw, sym, Symbol};
|
||||
use rustc_span::Span;
|
||||
use tracing::debug;
|
||||
|
||||
use crate::lints::{
|
||||
BadOptAccessDiag, DefaultHashTypesDiag, DiagOutOfImpl, LintPassByHand, NonExistentDocKeyword,
|
||||
NonGlobImportTypeIrInherent, QueryInstability, SpanUseEqCtxtDiag, TyQualified, TykindDiag,
|
||||
TykindKind, UntranslatableDiag,
|
||||
};
|
||||
use crate::{EarlyContext, EarlyLintPass, LateContext, LateLintPass, LintContext};
|
||||
use rustc_ast as ast;
|
||||
use rustc_hir::def::Res;
|
||||
use rustc_hir::{def_id::DefId, Expr, ExprKind, GenericArg, PatKind, Path, PathSegment, QPath};
|
||||
use rustc_hir::{BinOp, BinOpKind, HirId, Impl, Item, ItemKind, Node, Pat, Ty, TyKind};
|
||||
use rustc_middle::ty::{self, Ty as MiddleTy};
|
||||
use rustc_session::{declare_lint_pass, declare_tool_lint};
|
||||
use rustc_span::hygiene::{ExpnKind, MacroKind};
|
||||
use rustc_span::symbol::{kw, sym, Symbol};
|
||||
use rustc_span::Span;
|
||||
use tracing::debug;
|
||||
|
||||
declare_tool_lint! {
|
||||
/// The `default_hash_type` lint detects use of [`std::collections::HashMap`] and
|
||||
|
|
|
@ -14,22 +14,24 @@
|
|||
//! upon. As the ast is traversed, this keeps track of the current lint level
|
||||
//! for all lint attributes.
|
||||
|
||||
use crate::{passes::LateLintPassObject, LateContext, LateLintPass, LintStore};
|
||||
use std::any::Any;
|
||||
use std::cell::Cell;
|
||||
|
||||
use rustc_data_structures::stack::ensure_sufficient_stack;
|
||||
use rustc_data_structures::sync::{join, Lrc};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def_id::{LocalDefId, LocalModDefId};
|
||||
use rustc_hir::intravisit as hir_visit;
|
||||
use rustc_hir::HirId;
|
||||
use rustc_hir::{intravisit as hir_visit, HirId};
|
||||
use rustc_middle::hir::nested_filter;
|
||||
use rustc_middle::ty::{self, TyCtxt};
|
||||
use rustc_session::lint::LintPass;
|
||||
use rustc_session::Session;
|
||||
use rustc_span::Span;
|
||||
use std::any::Any;
|
||||
use std::cell::Cell;
|
||||
use tracing::debug;
|
||||
|
||||
use crate::passes::LateLintPassObject;
|
||||
use crate::{LateContext, LateLintPass, LintStore};
|
||||
|
||||
/// Extract the [`LintStore`] from [`Session`].
|
||||
///
|
||||
/// This function exists because [`Session::lint_store`] is type-erased.
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
use crate::{
|
||||
lints::{NonBindingLet, NonBindingLetSub},
|
||||
LateContext, LateLintPass, LintContext,
|
||||
};
|
||||
use rustc_errors::MultiSpan;
|
||||
use rustc_hir as hir;
|
||||
use rustc_middle::ty;
|
||||
use rustc_session::{declare_lint, declare_lint_pass};
|
||||
use rustc_span::{sym, Symbol};
|
||||
|
||||
use crate::lints::{NonBindingLet, NonBindingLetSub};
|
||||
use crate::{LateContext, LateLintPass, LintContext};
|
||||
|
||||
declare_lint! {
|
||||
/// The `let_underscore_drop` lint checks for statements which don't bind
|
||||
/// an expression which has a non-trivial Drop implementation to anything,
|
||||
|
|
|
@ -1,24 +1,7 @@
|
|||
use crate::errors::{CheckNameUnknownTool, RequestedLevel, UnsupportedGroup};
|
||||
use crate::lints::{
|
||||
DeprecatedLintNameFromCommandLine, RemovedLintFromCommandLine, RenamedLintFromCommandLine,
|
||||
UnknownLintFromCommandLine,
|
||||
};
|
||||
use crate::{
|
||||
builtin::MISSING_DOCS,
|
||||
context::{CheckLintNameResult, LintStore},
|
||||
fluent_generated as fluent,
|
||||
late::unerased_lint_store,
|
||||
lints::{
|
||||
DeprecatedLintName, IgnoredUnlessCrateSpecified, OverruledAttributeLint, RemovedLint,
|
||||
RenamedLint, RenamedLintSuggestion, UnknownLint, UnknownLintSuggestion,
|
||||
},
|
||||
};
|
||||
use rustc_ast as ast;
|
||||
use rustc_ast_pretty::pprust;
|
||||
use rustc_data_structures::fx::FxIndexMap;
|
||||
use rustc_errors::{Diag, LintDiagnostic, MultiSpan};
|
||||
use rustc_feature::{Features, GateIssue};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::intravisit::{self, Visitor};
|
||||
use rustc_hir::HirId;
|
||||
use rustc_index::IndexVec;
|
||||
|
@ -30,21 +13,30 @@ use rustc_middle::lint::{
|
|||
};
|
||||
use rustc_middle::query::Providers;
|
||||
use rustc_middle::ty::{RegisteredTools, TyCtxt};
|
||||
use rustc_session::lint::{
|
||||
builtin::{
|
||||
self, FORBIDDEN_LINT_GROUPS, RENAMED_AND_REMOVED_LINTS, SINGLE_USE_LIFETIMES,
|
||||
UNFULFILLED_LINT_EXPECTATIONS, UNKNOWN_LINTS, UNUSED_ATTRIBUTES,
|
||||
},
|
||||
Level, Lint, LintExpectationId, LintId,
|
||||
use rustc_session::lint::builtin::{
|
||||
self, FORBIDDEN_LINT_GROUPS, RENAMED_AND_REMOVED_LINTS, SINGLE_USE_LIFETIMES,
|
||||
UNFULFILLED_LINT_EXPECTATIONS, UNKNOWN_LINTS, UNUSED_ATTRIBUTES,
|
||||
};
|
||||
use rustc_session::lint::{Level, Lint, LintExpectationId, LintId};
|
||||
use rustc_session::Session;
|
||||
use rustc_span::symbol::{sym, Symbol};
|
||||
use rustc_span::{Span, DUMMY_SP};
|
||||
use tracing::{debug, instrument};
|
||||
use {rustc_ast as ast, rustc_hir as hir};
|
||||
|
||||
use crate::builtin::MISSING_DOCS;
|
||||
use crate::context::{CheckLintNameResult, LintStore};
|
||||
use crate::errors::{
|
||||
MalformedAttribute, MalformedAttributeSub, OverruledAttribute, OverruledAttributeSub,
|
||||
UnknownToolInScopedLint,
|
||||
CheckNameUnknownTool, MalformedAttribute, MalformedAttributeSub, OverruledAttribute,
|
||||
OverruledAttributeSub, RequestedLevel, UnknownToolInScopedLint, UnsupportedGroup,
|
||||
};
|
||||
use crate::fluent_generated as fluent;
|
||||
use crate::late::unerased_lint_store;
|
||||
use crate::lints::{
|
||||
DeprecatedLintName, DeprecatedLintNameFromCommandLine, IgnoredUnlessCrateSpecified,
|
||||
OverruledAttributeLint, RemovedLint, RemovedLintFromCommandLine, RenamedLint,
|
||||
RenamedLintFromCommandLine, RenamedLintSuggestion, UnknownLint, UnknownLintFromCommandLine,
|
||||
UnknownLintSuggestion,
|
||||
};
|
||||
|
||||
/// Collection of lint levels for the whole crate.
|
||||
|
|
|
@ -83,12 +83,6 @@ mod types;
|
|||
mod unit_bindings;
|
||||
mod unused;
|
||||
|
||||
pub use shadowed_into_iter::{ARRAY_INTO_ITER, BOXED_SLICE_INTO_ITER};
|
||||
|
||||
use rustc_hir::def_id::LocalModDefId;
|
||||
use rustc_middle::query::Providers;
|
||||
use rustc_middle::ty::TyCtxt;
|
||||
|
||||
use async_closures::AsyncClosureUsage;
|
||||
use async_fn_in_trait::AsyncFnInTrait;
|
||||
use builtin::*;
|
||||
|
@ -116,7 +110,11 @@ use precedence::*;
|
|||
use ptr_nulls::*;
|
||||
use redundant_semicolon::*;
|
||||
use reference_casting::*;
|
||||
use rustc_hir::def_id::LocalModDefId;
|
||||
use rustc_middle::query::Providers;
|
||||
use rustc_middle::ty::TyCtxt;
|
||||
use shadowed_into_iter::ShadowedIntoIter;
|
||||
pub use shadowed_into_iter::{ARRAY_INTO_ITER, BOXED_SLICE_INTO_ITER};
|
||||
use traits::*;
|
||||
use types::*;
|
||||
use unit_bindings::*;
|
||||
|
@ -124,14 +122,16 @@ use unused::*;
|
|||
|
||||
#[rustfmt::skip]
|
||||
pub use builtin::{MissingDoc, SoftLints};
|
||||
pub use context::{CheckLintNameResult, FindLintError, LintStore};
|
||||
pub use context::{EarlyContext, LateContext, LintContext};
|
||||
pub use context::{
|
||||
CheckLintNameResult, EarlyContext, FindLintError, LateContext, LintContext, LintStore,
|
||||
};
|
||||
pub use early::{check_ast_node, EarlyCheckNode};
|
||||
pub use late::{check_crate, late_lint_mod, unerased_lint_store};
|
||||
pub use passes::{EarlyLintPass, LateLintPass};
|
||||
pub use rustc_session::lint::Level::{self, *};
|
||||
pub use rustc_session::lint::{BufferedEarlyLint, FutureIncompatibleInfo, Lint, LintId};
|
||||
pub use rustc_session::lint::{LintPass, LintVec};
|
||||
pub use rustc_session::lint::{
|
||||
BufferedEarlyLint, FutureIncompatibleInfo, Lint, LintId, LintPass, LintVec,
|
||||
};
|
||||
|
||||
rustc_fluent_macro::fluent_messages! { "../messages.ftl" }
|
||||
|
||||
|
|
|
@ -2,27 +2,26 @@
|
|||
#![allow(rustc::untranslatable_diagnostic)]
|
||||
use std::num::NonZero;
|
||||
|
||||
use rustc_errors::codes::*;
|
||||
use rustc_errors::{
|
||||
Applicability, Diag, DiagArgValue, DiagMessage, DiagStyledString, ElidedLifetimeInPathSubdiag,
|
||||
EmissionGuarantee, LintDiagnostic, MultiSpan, SubdiagMessageOp, Subdiagnostic, SuggestionStyle,
|
||||
};
|
||||
use rustc_hir::def::Namespace;
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_hir::{self as hir};
|
||||
use rustc_macros::{LintDiagnostic, Subdiagnostic};
|
||||
use rustc_middle::ty::inhabitedness::InhabitedPredicate;
|
||||
use rustc_middle::ty::{Clause, PolyExistentialTraitRef, Ty, TyCtxt};
|
||||
use rustc_session::lint::AmbiguityErrorDiag;
|
||||
use rustc_session::Session;
|
||||
use rustc_span::edition::Edition;
|
||||
use rustc_span::symbol::{Ident, MacroRulesNormalizedIdent};
|
||||
use rustc_span::{sym, Span, Symbol};
|
||||
|
||||
use crate::builtin::{InitError, ShorthandAssocTyCollector, TypeAliasBounds};
|
||||
use crate::errors::{OverruledAttributeSub, RequestedLevel};
|
||||
use crate::fluent_generated as fluent;
|
||||
use crate::LateContext;
|
||||
use rustc_errors::{
|
||||
codes::*, Applicability, Diag, DiagArgValue, DiagMessage, DiagStyledString,
|
||||
ElidedLifetimeInPathSubdiag, EmissionGuarantee, LintDiagnostic, MultiSpan, SubdiagMessageOp,
|
||||
Subdiagnostic, SuggestionStyle,
|
||||
};
|
||||
use rustc_hir::{self as hir, def::Namespace, def_id::DefId};
|
||||
use rustc_macros::{LintDiagnostic, Subdiagnostic};
|
||||
use rustc_middle::ty::{
|
||||
inhabitedness::InhabitedPredicate, Clause, PolyExistentialTraitRef, Ty, TyCtxt,
|
||||
};
|
||||
use rustc_session::{lint::AmbiguityErrorDiag, Session};
|
||||
use rustc_span::{
|
||||
edition::Edition,
|
||||
sym,
|
||||
symbol::{Ident, MacroRulesNormalizedIdent},
|
||||
Span, Symbol,
|
||||
};
|
||||
use crate::{fluent_generated as fluent, LateContext};
|
||||
|
||||
// array_into_iter.rs
|
||||
#[derive(LintDiagnostic)]
|
||||
|
|
|
@ -1,16 +1,12 @@
|
|||
//! Migration code for the `expr_fragment_specifier_2024`
|
||||
//! rule.
|
||||
use tracing::debug;
|
||||
|
||||
use rustc_ast::token::Token;
|
||||
use rustc_ast::token::TokenKind;
|
||||
use rustc_ast::tokenstream::TokenStream;
|
||||
use rustc_ast::tokenstream::TokenTree;
|
||||
use rustc_session::declare_lint;
|
||||
use rustc_session::declare_lint_pass;
|
||||
use rustc_ast::token::{Token, TokenKind};
|
||||
use rustc_ast::tokenstream::{TokenStream, TokenTree};
|
||||
use rustc_session::lint::FutureIncompatibilityReason;
|
||||
use rustc_session::{declare_lint, declare_lint_pass};
|
||||
use rustc_span::edition::Edition;
|
||||
use rustc_span::sym;
|
||||
use tracing::debug;
|
||||
|
||||
use crate::lints::MacroExprFragment2024;
|
||||
use crate::EarlyLintPass;
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
use rustc_hir::{Expr, ExprKind, HirId, Stmt, StmtKind};
|
||||
use rustc_middle::query::Key;
|
||||
use rustc_middle::ty::{self, Ty};
|
||||
use rustc_session::{declare_lint, declare_lint_pass};
|
||||
|
||||
use crate::lints::MappingToUnit;
|
||||
use crate::{LateContext, LateLintPass, LintContext};
|
||||
|
||||
use rustc_hir::{Expr, ExprKind, HirId, Stmt, StmtKind};
|
||||
use rustc_middle::{
|
||||
query::Key,
|
||||
ty::{self, Ty},
|
||||
};
|
||||
use rustc_session::{declare_lint, declare_lint_pass};
|
||||
|
||||
declare_lint! {
|
||||
/// The `map_unit_fn` lint checks for `Iterator::map` receive
|
||||
/// a callable that returns `()`.
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
use crate::lints::CStringPtr;
|
||||
use crate::LateContext;
|
||||
use crate::LateLintPass;
|
||||
use crate::LintContext;
|
||||
use rustc_hir::{Expr, ExprKind};
|
||||
use rustc_middle::ty;
|
||||
use rustc_session::{declare_lint, declare_lint_pass};
|
||||
use rustc_span::{symbol::sym, Span};
|
||||
use rustc_span::symbol::sym;
|
||||
use rustc_span::Span;
|
||||
|
||||
use crate::lints::CStringPtr;
|
||||
use crate::{LateContext, LateLintPass, LintContext};
|
||||
|
||||
declare_lint! {
|
||||
/// The `temporary_cstring_as_ptr` lint detects getting the inner pointer of
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
use crate::{LateContext, LateLintPass, LintContext};
|
||||
|
||||
use rustc_hir as hir;
|
||||
use rustc_session::{declare_lint, declare_lint_pass};
|
||||
|
||||
use crate::{LateContext, LateLintPass, LintContext};
|
||||
|
||||
declare_lint! {
|
||||
/// The `multiple_supertrait_upcastable` lint detects when an object-safe trait has multiple
|
||||
/// supertraits.
|
||||
|
|
|
@ -1,8 +1,3 @@
|
|||
use crate::lints::{
|
||||
ConfusableIdentifierPair, IdentifierNonAsciiChar, IdentifierUncommonCodepoints,
|
||||
MixedScriptConfusables,
|
||||
};
|
||||
use crate::{EarlyContext, EarlyLintPass, LintContext};
|
||||
use rustc_ast as ast;
|
||||
use rustc_data_structures::fx::FxIndexMap;
|
||||
use rustc_data_structures::unord::UnordMap;
|
||||
|
@ -10,6 +5,12 @@ use rustc_session::{declare_lint, declare_lint_pass};
|
|||
use rustc_span::symbol::Symbol;
|
||||
use unicode_security::general_security_profile::IdentifierType;
|
||||
|
||||
use crate::lints::{
|
||||
ConfusableIdentifierPair, IdentifierNonAsciiChar, IdentifierUncommonCodepoints,
|
||||
MixedScriptConfusables,
|
||||
};
|
||||
use crate::{EarlyContext, EarlyLintPass, LintContext};
|
||||
|
||||
declare_lint! {
|
||||
/// The `non_ascii_idents` lint detects non-ASCII identifiers.
|
||||
///
|
||||
|
@ -152,9 +153,10 @@ declare_lint_pass!(NonAsciiIdents => [NON_ASCII_IDENTS, UNCOMMON_CODEPOINTS, CON
|
|||
|
||||
impl EarlyLintPass for NonAsciiIdents {
|
||||
fn check_crate(&mut self, cx: &EarlyContext<'_>, _: &ast::Crate) {
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use rustc_session::lint::Level;
|
||||
use rustc_span::Span;
|
||||
use std::collections::BTreeMap;
|
||||
use unicode_security::GeneralSecurityProfile;
|
||||
|
||||
let check_non_ascii_idents = cx.builder.lint_level(NON_ASCII_IDENTS).0 != Level::Allow;
|
||||
|
|
|
@ -1,19 +1,20 @@
|
|||
use crate::lints::{NonFmtPanicBraces, NonFmtPanicUnused};
|
||||
use crate::{fluent_generated as fluent, LateContext, LateLintPass, LintContext};
|
||||
use rustc_ast as ast;
|
||||
use rustc_errors::Applicability;
|
||||
use rustc_hir::{self as hir, LangItem};
|
||||
use rustc_infer::infer::TyCtxtInferExt;
|
||||
use rustc_middle::bug;
|
||||
use rustc_middle::lint::in_external_macro;
|
||||
use rustc_middle::ty;
|
||||
use rustc_middle::{bug, ty};
|
||||
use rustc_parse_format::{ParseMode, Parser, Piece};
|
||||
use rustc_session::lint::FutureIncompatibilityReason;
|
||||
use rustc_session::{declare_lint, declare_lint_pass};
|
||||
use rustc_span::edition::Edition;
|
||||
use rustc_span::{hygiene, sym, symbol::kw, InnerSpan, Span, Symbol};
|
||||
use rustc_span::symbol::kw;
|
||||
use rustc_span::{hygiene, sym, InnerSpan, Span, Symbol};
|
||||
use rustc_trait_selection::infer::InferCtxtExt;
|
||||
|
||||
use crate::lints::{NonFmtPanicBraces, NonFmtPanicUnused};
|
||||
use crate::{fluent_generated as fluent, LateContext, LateLintPass, LintContext};
|
||||
|
||||
declare_lint! {
|
||||
/// The `non_fmt_panics` lint detects `panic!(..)` invocations where the first
|
||||
/// argument is not a formatting string.
|
||||
|
|
|
@ -1,24 +1,23 @@
|
|||
use rustc_errors::MultiSpan;
|
||||
use rustc_hir::def::DefKind;
|
||||
use rustc_hir::intravisit::{self, Visitor};
|
||||
use rustc_hir::HirId;
|
||||
use rustc_hir::{def::DefKind, Body, Item, ItemKind, Node, TyKind};
|
||||
use rustc_hir::{Path, QPath};
|
||||
use rustc_hir::{Body, HirId, Item, ItemKind, Node, Path, QPath, TyKind};
|
||||
use rustc_infer::infer::InferCtxt;
|
||||
use rustc_infer::traits::{Obligation, ObligationCause};
|
||||
use rustc_middle::ty::{self, Binder, Ty, TyCtxt, TypeFoldable, TypeFolder};
|
||||
use rustc_middle::ty::{EarlyBinder, TraitRef, TypeSuperFoldable};
|
||||
use rustc_middle::ty::{
|
||||
self, Binder, EarlyBinder, TraitRef, Ty, TyCtxt, TypeFoldable, TypeFolder, TypeSuperFoldable,
|
||||
};
|
||||
use rustc_session::{declare_lint, impl_lint_pass};
|
||||
use rustc_span::def_id::{DefId, LOCAL_CRATE};
|
||||
use rustc_span::Span;
|
||||
use rustc_span::{sym, symbol::kw, ExpnKind, MacroKind, Symbol};
|
||||
use rustc_span::symbol::kw;
|
||||
use rustc_span::{sym, ExpnKind, MacroKind, Span, Symbol};
|
||||
use rustc_trait_selection::error_reporting::traits::ambiguity::{
|
||||
compute_applicable_impls_for_diagnostics, CandidateSource,
|
||||
};
|
||||
use rustc_trait_selection::infer::TyCtxtInferExt;
|
||||
|
||||
use crate::fluent_generated as fluent;
|
||||
use crate::lints::{NonLocalDefinitionsCargoUpdateNote, NonLocalDefinitionsDiag};
|
||||
use crate::{LateContext, LateLintPass, LintContext};
|
||||
use crate::{fluent_generated as fluent, LateContext, LateLintPass, LintContext};
|
||||
|
||||
declare_lint! {
|
||||
/// The `non_local_definitions` lint checks for `impl` blocks and `#[macro_export]`
|
||||
|
|
|
@ -1,11 +1,3 @@
|
|||
use crate::lints::{
|
||||
NonCamelCaseType, NonCamelCaseTypeSub, NonSnakeCaseDiag, NonSnakeCaseDiagSub,
|
||||
NonUpperCaseGlobal, NonUpperCaseGlobalSub,
|
||||
};
|
||||
use crate::{EarlyContext, EarlyLintPass, LateContext, LateLintPass, LintContext};
|
||||
use rustc_ast as ast;
|
||||
use rustc_attr as attr;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::{DefKind, Res};
|
||||
use rustc_hir::intravisit::FnKind;
|
||||
use rustc_hir::{GenericParamKind, PatKind};
|
||||
|
@ -16,6 +8,13 @@ use rustc_span::def_id::LocalDefId;
|
|||
use rustc_span::symbol::{sym, Ident};
|
||||
use rustc_span::{BytePos, Span};
|
||||
use rustc_target::spec::abi::Abi;
|
||||
use {rustc_ast as ast, rustc_attr as attr, rustc_hir as hir};
|
||||
|
||||
use crate::lints::{
|
||||
NonCamelCaseType, NonCamelCaseTypeSub, NonSnakeCaseDiag, NonSnakeCaseDiagSub,
|
||||
NonUpperCaseGlobal, NonUpperCaseGlobalSub,
|
||||
};
|
||||
use crate::{EarlyContext, EarlyLintPass, LateContext, LateLintPass, LintContext};
|
||||
|
||||
#[derive(PartialEq)]
|
||||
pub enum MethodLateContext {
|
||||
|
|
|
@ -1,9 +1,3 @@
|
|||
use crate::context::LintContext;
|
||||
use crate::lints::{
|
||||
NoopMethodCallDiag, SuspiciousDoubleRefCloneDiag, SuspiciousDoubleRefDerefDiag,
|
||||
};
|
||||
use crate::LateContext;
|
||||
use crate::LateLintPass;
|
||||
use rustc_hir::def::DefKind;
|
||||
use rustc_hir::{Expr, ExprKind};
|
||||
use rustc_middle::ty;
|
||||
|
@ -11,6 +5,12 @@ use rustc_middle::ty::adjustment::Adjust;
|
|||
use rustc_session::{declare_lint, declare_lint_pass};
|
||||
use rustc_span::symbol::sym;
|
||||
|
||||
use crate::context::LintContext;
|
||||
use crate::lints::{
|
||||
NoopMethodCallDiag, SuspiciousDoubleRefCloneDiag, SuspiciousDoubleRefDerefDiag,
|
||||
};
|
||||
use crate::{LateContext, LateLintPass};
|
||||
|
||||
declare_lint! {
|
||||
/// The `noop_method_call` lint detects specific calls to noop methods
|
||||
/// such as a calling `<&T as Clone>::clone` where `T: !Clone`.
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
use rustc_hir as hir;
|
||||
use rustc_infer::infer::TyCtxtInferExt;
|
||||
use rustc_macros::{LintDiagnostic, Subdiagnostic};
|
||||
use rustc_middle::ty::fold::BottomUpFolder;
|
||||
use rustc_middle::ty::print::{PrintTraitPredicateExt as _, TraitPredPrintModifiersAndPath};
|
||||
use rustc_middle::ty::{self, fold::BottomUpFolder, Ty, TypeFoldable};
|
||||
use rustc_middle::ty::{self, Ty, TypeFoldable};
|
||||
use rustc_session::{declare_lint, declare_lint_pass};
|
||||
use rustc_span::{symbol::kw, Span};
|
||||
use rustc_span::symbol::kw;
|
||||
use rustc_span::Span;
|
||||
use rustc_trait_selection::traits::{self, ObligationCtxt};
|
||||
|
||||
use crate::{LateContext, LateLintPass, LintContext};
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
use crate::lints::PassByValueDiag;
|
||||
use crate::{LateContext, LateLintPass, LintContext};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::Res;
|
||||
use rustc_hir::{GenericArg, PathSegment, QPath, TyKind};
|
||||
|
@ -7,6 +5,9 @@ use rustc_middle::ty;
|
|||
use rustc_session::{declare_lint_pass, declare_tool_lint};
|
||||
use rustc_span::symbol::sym;
|
||||
|
||||
use crate::lints::PassByValueDiag;
|
||||
use crate::{LateContext, LateLintPass, LintContext};
|
||||
|
||||
declare_tool_lint! {
|
||||
/// The `rustc_pass_by_value` lint marks a type with `#[rustc_pass_by_value]` requiring it to
|
||||
/// always be passed by value. This is usually used for types that are thin wrappers around
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
use crate::context::{EarlyContext, LateContext};
|
||||
|
||||
use rustc_session::lint::builtin::HardwiredLints;
|
||||
use rustc_session::lint::LintPass;
|
||||
|
||||
use crate::context::{EarlyContext, LateContext};
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! late_lint_methods {
|
||||
($macro:path, $args:tt) => (
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
use crate::{lints::PtrNullChecksDiag, LateContext, LateLintPass, LintContext};
|
||||
use rustc_ast::LitKind;
|
||||
use rustc_hir::{BinOpKind, Expr, ExprKind, TyKind};
|
||||
use rustc_session::{declare_lint, declare_lint_pass};
|
||||
use rustc_span::sym;
|
||||
|
||||
use crate::lints::PtrNullChecksDiag;
|
||||
use crate::{LateContext, LateLintPass, LintContext};
|
||||
|
||||
declare_lint! {
|
||||
/// The `useless_ptr_null_checks` lint checks for useless null checks against pointers
|
||||
/// obtained from non-null types.
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
use crate::{lints::RedundantSemicolonsDiag, EarlyContext, EarlyLintPass, LintContext};
|
||||
use rustc_ast::{Block, StmtKind};
|
||||
use rustc_session::{declare_lint, declare_lint_pass};
|
||||
use rustc_span::Span;
|
||||
|
||||
use crate::lints::RedundantSemicolonsDiag;
|
||||
use crate::{EarlyContext, EarlyLintPass, LintContext};
|
||||
|
||||
declare_lint! {
|
||||
/// The `redundant_semicolons` lint detects unnecessary trailing
|
||||
/// semicolons.
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
use rustc_ast::Mutability;
|
||||
use rustc_hir::{Expr, ExprKind, UnOp};
|
||||
use rustc_middle::ty::layout::LayoutOf as _;
|
||||
use rustc_middle::ty::{self, layout::TyAndLayout};
|
||||
use rustc_middle::ty::layout::{LayoutOf as _, TyAndLayout};
|
||||
use rustc_middle::ty::{self};
|
||||
use rustc_session::{declare_lint, declare_lint_pass};
|
||||
use rustc_span::sym;
|
||||
|
||||
use crate::{lints::InvalidReferenceCastingDiag, LateContext, LateLintPass, LintContext};
|
||||
use crate::lints::InvalidReferenceCastingDiag;
|
||||
use crate::{LateContext, LateLintPass, LintContext};
|
||||
|
||||
declare_lint! {
|
||||
/// The `invalid_reference_casting` lint checks for casts of `&T` to `&mut T`
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
use crate::lints::{ShadowedIntoIterDiag, ShadowedIntoIterDiagSub};
|
||||
use crate::{LateContext, LateLintPass, LintContext};
|
||||
use rustc_hir as hir;
|
||||
use rustc_middle::ty::{self, Ty};
|
||||
use rustc_session::lint::FutureIncompatibilityReason;
|
||||
use rustc_session::{declare_lint, impl_lint_pass};
|
||||
use rustc_span::edition::Edition;
|
||||
|
||||
use crate::lints::{ShadowedIntoIterDiag, ShadowedIntoIterDiagSub};
|
||||
use crate::{LateContext, LateLintPass, LintContext};
|
||||
|
||||
declare_lint! {
|
||||
/// The `array_into_iter` lint detects calling `into_iter` on arrays.
|
||||
///
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
use crate::levels::parse_lint_and_tool_name;
|
||||
use rustc_span::{create_default_session_globals_then, Symbol};
|
||||
|
||||
use crate::levels::parse_lint_and_tool_name;
|
||||
|
||||
#[test]
|
||||
fn parse_lint_no_tool() {
|
||||
create_default_session_globals_then(|| {
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
use crate::lints::{DropGlue, DropTraitConstraintsDiag};
|
||||
use crate::LateContext;
|
||||
use crate::LateLintPass;
|
||||
use crate::LintContext;
|
||||
use rustc_hir::{self as hir, LangItem};
|
||||
use rustc_session::{declare_lint, declare_lint_pass};
|
||||
use rustc_span::symbol::sym;
|
||||
|
||||
use crate::lints::{DropGlue, DropTraitConstraintsDiag};
|
||||
use crate::{LateContext, LateLintPass, LintContext};
|
||||
|
||||
declare_lint! {
|
||||
/// The `drop_bounds` lint checks for generics with `std::ops::Drop` as
|
||||
/// bounds.
|
||||
|
|
|
@ -1,39 +1,33 @@
|
|||
use crate::{
|
||||
fluent_generated as fluent,
|
||||
lints::{
|
||||
AmbiguousWidePointerComparisons, AmbiguousWidePointerComparisonsAddrMetadataSuggestion,
|
||||
AmbiguousWidePointerComparisonsAddrSuggestion, AtomicOrderingFence, AtomicOrderingLoad,
|
||||
AtomicOrderingStore, ImproperCTypes, InvalidAtomicOrderingDiag, InvalidNanComparisons,
|
||||
InvalidNanComparisonsSuggestion, OnlyCastu8ToChar, OverflowingBinHex,
|
||||
OverflowingBinHexSign, OverflowingBinHexSignBitSub, OverflowingBinHexSub, OverflowingInt,
|
||||
OverflowingIntHelp, OverflowingLiteral, OverflowingUInt, RangeEndpointOutOfRange,
|
||||
UnusedComparisons, UseInclusiveRange, VariantSizeDifferencesDiag,
|
||||
},
|
||||
};
|
||||
use crate::{LateContext, LateLintPass, LintContext};
|
||||
use rustc_ast as ast;
|
||||
use rustc_attr as attr;
|
||||
use std::iter;
|
||||
use std::ops::ControlFlow;
|
||||
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_errors::DiagMessage;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::{is_range_literal, Expr, ExprKind, Node};
|
||||
use rustc_middle::bug;
|
||||
use rustc_middle::ty::layout::{IntegerExt, LayoutOf, SizeSkeleton};
|
||||
use rustc_middle::ty::GenericArgsRef;
|
||||
use rustc_middle::ty::{
|
||||
self, AdtKind, Ty, TyCtxt, TypeSuperVisitable, TypeVisitable, TypeVisitableExt,
|
||||
self, AdtKind, GenericArgsRef, Ty, TyCtxt, TypeSuperVisitable, TypeVisitable, TypeVisitableExt,
|
||||
};
|
||||
use rustc_session::{declare_lint, declare_lint_pass, impl_lint_pass};
|
||||
use rustc_span::def_id::LocalDefId;
|
||||
use rustc_span::source_map;
|
||||
use rustc_span::symbol::sym;
|
||||
use rustc_span::{Span, Symbol};
|
||||
use rustc_target::abi::{Abi, Size, WrappingRange};
|
||||
use rustc_target::abi::{Integer, TagEncoding, Variants};
|
||||
use rustc_span::{source_map, Span, Symbol};
|
||||
use rustc_target::abi::{Abi, Integer, Size, TagEncoding, Variants, WrappingRange};
|
||||
use rustc_target::spec::abi::Abi as SpecAbi;
|
||||
use std::iter;
|
||||
use std::ops::ControlFlow;
|
||||
use tracing::debug;
|
||||
use {rustc_ast as ast, rustc_attr as attr, rustc_hir as hir};
|
||||
|
||||
use crate::lints::{
|
||||
AmbiguousWidePointerComparisons, AmbiguousWidePointerComparisonsAddrMetadataSuggestion,
|
||||
AmbiguousWidePointerComparisonsAddrSuggestion, AtomicOrderingFence, AtomicOrderingLoad,
|
||||
AtomicOrderingStore, ImproperCTypes, InvalidAtomicOrderingDiag, InvalidNanComparisons,
|
||||
InvalidNanComparisonsSuggestion, OnlyCastu8ToChar, OverflowingBinHex, OverflowingBinHexSign,
|
||||
OverflowingBinHexSignBitSub, OverflowingBinHexSub, OverflowingInt, OverflowingIntHelp,
|
||||
OverflowingLiteral, OverflowingUInt, RangeEndpointOutOfRange, UnusedComparisons,
|
||||
UseInclusiveRange, VariantSizeDifferencesDiag,
|
||||
};
|
||||
use crate::{fluent_generated as fluent, LateContext, LateLintPass, LintContext};
|
||||
|
||||
declare_lint! {
|
||||
/// The `unused_comparisons` lint detects comparisons made useless by
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
use crate::lints::UnitBindingsDiag;
|
||||
use crate::{LateLintPass, LintContext};
|
||||
use rustc_hir as hir;
|
||||
use rustc_session::{declare_lint, declare_lint_pass};
|
||||
|
||||
use crate::lints::UnitBindingsDiag;
|
||||
use crate::{LateLintPass, LintContext};
|
||||
|
||||
declare_lint! {
|
||||
/// The `unit_bindings` lint detects cases where bindings are useless because they have
|
||||
/// the unit type `()` as their inferred type. The lint is suppressed if the user explicitly
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
use crate::lints::{
|
||||
PathStatementDrop, PathStatementDropSub, PathStatementNoEffect, UnusedAllocationDiag,
|
||||
UnusedAllocationMutDiag, UnusedClosure, UnusedCoroutine, UnusedDef, UnusedDefSuggestion,
|
||||
UnusedDelim, UnusedDelimSuggestion, UnusedImportBracesDiag, UnusedOp, UnusedOpSuggestion,
|
||||
UnusedResult,
|
||||
};
|
||||
use crate::Lint;
|
||||
use crate::{EarlyContext, EarlyLintPass, LateContext, LateLintPass, LintContext};
|
||||
use std::iter;
|
||||
use std::ops::ControlFlow;
|
||||
|
||||
use rustc_ast as ast;
|
||||
use rustc_ast::util::{classify, parser};
|
||||
use rustc_ast::{ExprKind, StmtKind};
|
||||
|
@ -14,16 +9,20 @@ use rustc_hir::def::{DefKind, Res};
|
|||
use rustc_hir::def_id::DefId;
|
||||
use rustc_hir::{self as hir, LangItem};
|
||||
use rustc_infer::traits::util::elaborate;
|
||||
use rustc_middle::ty::adjustment;
|
||||
use rustc_middle::ty::{self, Ty};
|
||||
use rustc_middle::ty::{self, adjustment, Ty};
|
||||
use rustc_session::{declare_lint, declare_lint_pass, impl_lint_pass};
|
||||
use rustc_span::symbol::Symbol;
|
||||
use rustc_span::symbol::{kw, sym};
|
||||
use rustc_span::symbol::{kw, sym, Symbol};
|
||||
use rustc_span::{BytePos, Span};
|
||||
use std::iter;
|
||||
use std::ops::ControlFlow;
|
||||
use tracing::instrument;
|
||||
|
||||
use crate::lints::{
|
||||
PathStatementDrop, PathStatementDropSub, PathStatementNoEffect, UnusedAllocationDiag,
|
||||
UnusedAllocationMutDiag, UnusedClosure, UnusedCoroutine, UnusedDef, UnusedDefSuggestion,
|
||||
UnusedDelim, UnusedDelimSuggestion, UnusedImportBracesDiag, UnusedOp, UnusedOpSuggestion,
|
||||
UnusedResult,
|
||||
};
|
||||
use crate::{EarlyContext, EarlyLintPass, LateContext, LateLintPass, Lint, LintContext};
|
||||
|
||||
declare_lint! {
|
||||
/// The `unused_must_use` lint detects unused result of a type flagged as
|
||||
/// `#[must_use]`.
|
||||
|
@ -1205,7 +1204,8 @@ impl EarlyLintPass for UnusedParens {
|
|||
}
|
||||
|
||||
fn check_pat(&mut self, cx: &EarlyContext<'_>, p: &ast::Pat) {
|
||||
use ast::{Mutability, PatKind::*};
|
||||
use ast::Mutability;
|
||||
use ast::PatKind::*;
|
||||
let keep_space = (false, false);
|
||||
match &p.kind {
|
||||
// Do not lint on `(..)` as that will result in the other arms being useless.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue