Skip to content

chore: clippy nursery#535

Open
StuartHarris wants to merge 2 commits into
masterfrom
clippy-nursery
Open

chore: clippy nursery#535
StuartHarris wants to merge 2 commits into
masterfrom
clippy-nursery

Conversation

@StuartHarris
Copy link
Copy Markdown
Member

Fixes for clippy::nursery, including adding to CI

Base automatically changed from remove-crux_cli to master May 18, 2026 14:51
@ManevilleF
Copy link
Copy Markdown
Contributor

ManevilleF commented May 19, 2026

Nice ! clippy::nursery is a gold mine of useful lints !

I would suggest adding the lints in the Cargo.toml directly and be able to selectively disable some, as lots in nursery (though less than in pedantic) can be false negatives.
I would also advise against using missing_const_for_fn or be particulary careful on which public functions become const, as rolling this back will be a breaking change

Copy link
Copy Markdown
Collaborator

@charypar charypar left a comment

Choose a reason for hiding this comment

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

Not sure I agree with the push for map_or_ – seems to hurt readability – but don't have a strong opinion (and forced consistency is nice.)

Comment thread examples/notes/shared/src/app.rs Outdated

if let Some(cmd) = self.command.as_mut() {
#[allow(clippy::needless_collect)]
for event in cmd.events().collect::<Vec<_>>() {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I wonder whether something like .cloned() would be better and not trigger clippy...?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It would, but Event is not Clone. We can't avoid the collect, because we're borrowing self through cmd, so we then can't mutably borrow it again inside the loop. But I can convince clippy that the collect is load-bearing by extracting to a variable. Gonna do that.

/// `FakeShell` implements `EffectSender` for use in our internal tests.
#[derive(Clone, Default)]
pub(crate) struct FakeShell {
pub struct FakeShell {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I personally don't like this clippy, I think it's technically correct in that yes the parent shell's visibility is the real controlling factor, but it does express something here that the intent is that this be crate-level. On my projects I have this ignored.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

More than happy to revert these and add a crate-wide exception.

@ManevilleF
Copy link
Copy Markdown
Contributor

A typical way would be to set the priority of the clippy lint group "nursery" to -1 and then selectively disable some lints from that group like map_or or the crate visibility lints

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants