Skip to content

Commit 295225b

Browse files
thomccjyn514
authored andcommitted
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
1 parent c9e45e4 commit 295225b

20 files changed

+9
-1425
lines changed

clippy_lints/src/atomic_ordering.rs

Lines changed: 0 additions & 230 deletions
This file was deleted.

clippy_lints/src/lib.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,6 @@ mod asm_syntax;
165165
mod assertions_on_constants;
166166
mod assign_ops;
167167
mod async_yields_async;
168-
mod atomic_ordering;
169168
mod attrs;
170169
mod await_holding_invalid;
171170
mod bit_mask;
@@ -537,7 +536,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
537536
assign_ops::ASSIGN_OP_PATTERN,
538537
assign_ops::MISREFACTORED_ASSIGN_OP,
539538
async_yields_async::ASYNC_YIELDS_ASYNC,
540-
atomic_ordering::INVALID_ATOMIC_ORDERING,
541539
attrs::BLANKET_CLIPPY_RESTRICTION_LINTS,
542540
attrs::DEPRECATED_CFG_ATTR,
543541
attrs::DEPRECATED_SEMVER,
@@ -1174,7 +1172,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
11741172
LintId::of(assign_ops::ASSIGN_OP_PATTERN),
11751173
LintId::of(assign_ops::MISREFACTORED_ASSIGN_OP),
11761174
LintId::of(async_yields_async::ASYNC_YIELDS_ASYNC),
1177-
LintId::of(atomic_ordering::INVALID_ATOMIC_ORDERING),
11781175
LintId::of(attrs::BLANKET_CLIPPY_RESTRICTION_LINTS),
11791176
LintId::of(attrs::DEPRECATED_CFG_ATTR),
11801177
LintId::of(attrs::DEPRECATED_SEMVER),
@@ -1670,7 +1667,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
16701667
LintId::of(absurd_extreme_comparisons::ABSURD_EXTREME_COMPARISONS),
16711668
LintId::of(approx_const::APPROX_CONSTANT),
16721669
LintId::of(async_yields_async::ASYNC_YIELDS_ASYNC),
1673-
LintId::of(atomic_ordering::INVALID_ATOMIC_ORDERING),
16741670
LintId::of(attrs::DEPRECATED_SEMVER),
16751671
LintId::of(attrs::MISMATCHED_TARGET_OS),
16761672
LintId::of(attrs::USELESS_ATTRIBUTE),
@@ -2044,7 +2040,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
20442040
store.register_late_pass(|| box floating_point_arithmetic::FloatingPointArithmetic);
20452041
store.register_early_pass(|| box as_conversions::AsConversions);
20462042
store.register_late_pass(|| box let_underscore::LetUnderscore);
2047-
store.register_late_pass(|| box atomic_ordering::AtomicOrdering);
20482043
store.register_early_pass(|| box single_component_path_imports::SingleComponentPathImports);
20492044
let max_fn_params_bools = conf.max_fn_params_bools;
20502045
let max_struct_bools = conf.max_struct_bools;
@@ -2183,6 +2178,7 @@ pub fn register_renamed(ls: &mut rustc_lint::LintStore) {
21832178
ls.register_renamed("clippy::temporary_cstring_as_ptr", "temporary_cstring_as_ptr");
21842179
ls.register_renamed("clippy::panic_params", "non_fmt_panics");
21852180
ls.register_renamed("clippy::unknown_clippy_lints", "unknown_lints");
2181+
ls.register_renamed("clippy::invalid_atomic_ordering", "invalid_atomic_ordering");
21862182
}
21872183

21882184
// only exists to let the dogfood integration test works.

tests/ui/atomic_ordering_bool.rs

Lines changed: 0 additions & 25 deletions
This file was deleted.

tests/ui/atomic_ordering_bool.stderr

Lines changed: 0 additions & 35 deletions
This file was deleted.

tests/ui/atomic_ordering_exchange.rs

Lines changed: 0 additions & 45 deletions
This file was deleted.

0 commit comments

Comments
 (0)