rust-clippy icon indicating copy to clipboard operation
rust-clippy copied to clipboard

feat(rwlock_atomic): add new lints for using RwLock with atomic types

Open Tunglies opened this issue 1 month ago • 7 comments

changelog: [rwlock_atomic]: new lint changelog: [rwlock_integer]: new lint

Tunglies avatar Dec 02 '25 20:12 Tunglies

r? @blyxyas

rustbot has assigned @blyxyas. They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

rustbot avatar Dec 02 '25 20:12 rustbot

Hey @blyxyas, would you be interested in reviewing?

Tunglies avatar Dec 02 '25 20:12 Tunglies

Yes @Tunglies I'll review this one, could you give us some more information in the pull request's description? Is this fixing any existing issues? In general, more context on why this pull request is needed would be very appreciated.

Thanks!

blyxyas avatar Dec 02 '25 21:12 blyxyas

Yes @Tunglies I'll review this one, could you give us some more information in the pull request's description? Is this fixing any existing issues? In general, more context on why this pull request is needed would be very appreciated.

Thanks!

I found Mutex rulesclippy::mutex_atomic and clippy::mutex_integer rules, use them for my comunnity's project clash-verge-rev to helps reduce Arc and lock performance cost, most are Arc<Mutex/Rwlock<bool>>. I tried write some basic branchmark for Arc<Mutex/RwLock<T>> and Atomic<T> with std lib, found that Arc<RwLock<T>> is even slower than Arc<Mutex<T>>. While continue performance development, if has Rwlock rule for this usage same as clippy::mutex_atomic and clippy::mutex_integer would be more convenience.

Tunglies avatar Dec 02 '25 23:12 Tunglies

Reminder, once the PR becomes ready for a review, use @rustbot ready.

rustbot avatar Dec 04 '25 12:12 rustbot

Hey @blyxyas I have merged the lints and renamed the lint file and its uibless counterpart. Looking forward to your feedback :3

Tunglies avatar Dec 09 '25 01:12 Tunglies

@rustbot ready

Tunglies avatar Dec 09 '25 01:12 Tunglies

:umbrella: The latest upstream changes (possibly 741b684c90097002ca98322160c6c92e7a248b47) made this pull request unmergeable. Please resolve the merge conflicts.

rustbot avatar Dec 18 '25 14:12 rustbot

Hey @blyxyas, wondering if you still have interested with this? :)

Tunglies avatar Dec 18 '25 14:12 Tunglies