Skip to content

Conversation

@Tunglies
Copy link

@Tunglies Tunglies commented Dec 2, 2025

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

changelog: [`rwlock_atomic`]: new lint
changelog: [`rwlock_integer`]: new lint
@rustbot rustbot added needs-fcp S-waiting-on-review Status: Awaiting review from the assignee but also interested parties labels Dec 2, 2025
@rustbot
Copy link
Collaborator

rustbot commented Dec 2, 2025

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

@Tunglies
Copy link
Author

Tunglies commented Dec 2, 2025

Hey @blyxyas, would you be interested in reviewing?

@blyxyas
Copy link
Member

blyxyas commented Dec 2, 2025

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!

@Tunglies
Copy link
Author

Tunglies commented Dec 2, 2025

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.

Copy link
Member

@blyxyas blyxyas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems that the lint logic is really similar to mutex_atomic, could you merge these?

View changes since this review

Comment on lines +24 to +26
/// On the other hand, `RwLock`s are, in general, easier to
/// verify correctness. An atomic does not behave the same as
/// an equivalent RwLock.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand this paragraph. Is RwLock supposed to be Atomic here? Could you clarify? ミ๏v๏彡

/// ```
#[clippy::version = "1.93.0"]
pub RWLOCK_INTEGER,
restriction,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that this lints should be suspicious, what do you think? (=ↀωↀ=)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems that these two lints are very very similar to mutex_atomic.rs, could you merge these 4 lints? They same like 90% of the same logic

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties labels Dec 4, 2025
@rustbot
Copy link
Collaborator

rustbot commented Dec 4, 2025

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-fcp S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants