Uplift the invalid_atomic_ordering lint from clippy to rustc
- Deprecate clippy::invalid_atomic_ordering - Use rustc_diagnostic_item for the orderings in the invalid_atomic_ordering lint - Reduce code duplication - Give up on making enum variants diagnostic items and just look for `Ordering` instead I ran into tons of trouble with this because apparently the change to store HIR attrs in a side table also gave the DefIds of the constructor instead of the variant itself. So I had to change `matches_ordering` to also check the grandparent of the defid as well. - Rename `atomic_ordering_x` symbols to just the name of the variant - Fix typos in checks - there were a few places that said "may not be Release" in the diagnostic but actually checked for SeqCst in the lint. - Make constant items const - Use fewer diagnostic items - Only look at arguments after making sure the method matches This prevents an ICE when there aren't enough arguments. - Ignore trait methods - Only check Ctors instead of going through `qpath_res` The functions take values, so this couldn't ever be anything else. - Add if_chain to allowed dependencies - Fix grammar - Remove unnecessary allow
This commit is contained in:
committed by
Joshua Nelson
parent
c9e45e47d5
commit
295225b660
@@ -165,7 +165,6 @@ mod asm_syntax;
|
||||
mod assertions_on_constants;
|
||||
mod assign_ops;
|
||||
mod async_yields_async;
|
||||
mod atomic_ordering;
|
||||
mod attrs;
|
||||
mod await_holding_invalid;
|
||||
mod bit_mask;
|
||||
@@ -537,7 +536,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
|
||||
assign_ops::ASSIGN_OP_PATTERN,
|
||||
assign_ops::MISREFACTORED_ASSIGN_OP,
|
||||
async_yields_async::ASYNC_YIELDS_ASYNC,
|
||||
atomic_ordering::INVALID_ATOMIC_ORDERING,
|
||||
attrs::BLANKET_CLIPPY_RESTRICTION_LINTS,
|
||||
attrs::DEPRECATED_CFG_ATTR,
|
||||
attrs::DEPRECATED_SEMVER,
|
||||
@@ -1174,7 +1172,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
|
||||
LintId::of(assign_ops::ASSIGN_OP_PATTERN),
|
||||
LintId::of(assign_ops::MISREFACTORED_ASSIGN_OP),
|
||||
LintId::of(async_yields_async::ASYNC_YIELDS_ASYNC),
|
||||
LintId::of(atomic_ordering::INVALID_ATOMIC_ORDERING),
|
||||
LintId::of(attrs::BLANKET_CLIPPY_RESTRICTION_LINTS),
|
||||
LintId::of(attrs::DEPRECATED_CFG_ATTR),
|
||||
LintId::of(attrs::DEPRECATED_SEMVER),
|
||||
@@ -1670,7 +1667,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
|
||||
LintId::of(absurd_extreme_comparisons::ABSURD_EXTREME_COMPARISONS),
|
||||
LintId::of(approx_const::APPROX_CONSTANT),
|
||||
LintId::of(async_yields_async::ASYNC_YIELDS_ASYNC),
|
||||
LintId::of(atomic_ordering::INVALID_ATOMIC_ORDERING),
|
||||
LintId::of(attrs::DEPRECATED_SEMVER),
|
||||
LintId::of(attrs::MISMATCHED_TARGET_OS),
|
||||
LintId::of(attrs::USELESS_ATTRIBUTE),
|
||||
@@ -2044,7 +2040,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
|
||||
store.register_late_pass(|| box floating_point_arithmetic::FloatingPointArithmetic);
|
||||
store.register_early_pass(|| box as_conversions::AsConversions);
|
||||
store.register_late_pass(|| box let_underscore::LetUnderscore);
|
||||
store.register_late_pass(|| box atomic_ordering::AtomicOrdering);
|
||||
store.register_early_pass(|| box single_component_path_imports::SingleComponentPathImports);
|
||||
let max_fn_params_bools = conf.max_fn_params_bools;
|
||||
let max_struct_bools = conf.max_struct_bools;
|
||||
@@ -2183,6 +2178,7 @@ pub fn register_renamed(ls: &mut rustc_lint::LintStore) {
|
||||
ls.register_renamed("clippy::temporary_cstring_as_ptr", "temporary_cstring_as_ptr");
|
||||
ls.register_renamed("clippy::panic_params", "non_fmt_panics");
|
||||
ls.register_renamed("clippy::unknown_clippy_lints", "unknown_lints");
|
||||
ls.register_renamed("clippy::invalid_atomic_ordering", "invalid_atomic_ordering");
|
||||
}
|
||||
|
||||
// only exists to let the dogfood integration test works.
|
||||
|
||||
Reference in New Issue
Block a user