Skip to content

Conversation

@profetia
Copy link
Contributor

@profetia profetia commented Jul 21, 2025

Closes #13394

changelog: [missing_inline_in_public_items] fix failure to fulfill expect in --test build

@rustbot
Copy link
Collaborator

rustbot commented Jul 21, 2025

r? @y21

rustbot has assigned @y21.
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 rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Jul 21, 2025
@profetia profetia force-pushed the issue13394 branch 2 times, most recently from c1a51b3 to e528256 Compare July 21, 2025 15:04
Copy link
Member

@y21 y21 left a comment

Choose a reason for hiding this comment

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

This does mean that something like #[expect(clippy::missing_inline_in_public_items)] fn private_function() {} passes the expectation with --test even though the lint would never emit a warning there, but I'm not really sure how we could avoid that so this seems fine

@Alexendoo
Copy link
Member

This looks like a symptom rather than the root of the issue, that the following is a false negative when ran with cargo clippy --tests

#![warn(clippy::missing_inline_in_public_items)]

pub fn foo() -> u32 {
    0
}

It should still lint foo as it would for cargo clippy

@profetia
Copy link
Contributor Author

Hmm.. Im confused. What is the expected behavior in --test ?

@profetia
Copy link
Contributor Author

I doubt if it is possible to know the original crate type in --test

@profetia profetia requested a review from y21 July 27, 2025 07:15
@profetia
Copy link
Contributor Author

r? clippy

@Alexendoo
Copy link
Member

I doubt if it is possible to know the original crate type in --test

Yeah I think that might well be the case

Something we could do is remove the is_executable_or_proc_macro check entirely, it would be a useless warning for bin crates but as it's a restriction lint that should be okay

@profetia
Copy link
Contributor Author

Updated. Check for executables are now removed

@github-actions
Copy link

github-actions bot commented Aug 21, 2025

Lintcheck changes for 33a5d5e

Lint Added Removed Changed
clippy::missing_inline_in_public_items 10 0 0

This comment will be updated if you push new changes

@profetia
Copy link
Contributor Author

r? clippy

@rustbot rustbot assigned dswij and unassigned Jarcho Sep 30, 2025
@profetia
Copy link
Contributor Author

r? clippy

@rustbot rustbot assigned Centri3 and unassigned dswij Oct 21, 2025
Copy link
Member

@Centri3 Centri3 left a comment

Choose a reason for hiding this comment

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

I'll think about this more tomorrow. One concern for now

View changes since this review

@rustbot

This comment has been minimized.

@rustbot
Copy link
Collaborator

rustbot commented Oct 22, 2025

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@Centri3
Copy link
Member

Centri3 commented Oct 22, 2025

I think I'm +1 on linting in binary crates. It makes sense to me to still lint as maybe they'd extract it into a library crate in the future. The only file this doesn't make sense in is main.rs.

This does mean that something like #[expect(clippy::missing_inline_in_public_items)] fn private_function() {} passes the expectation with --test even though the lint would never emit a warning there, but I'm not really sure how we could avoid that so this seems fine

Just to confirm, is this no longer an issue with the new implementation? Is this just something that happens with some lints?

@profetia
Copy link
Contributor Author

Yes, this is no longer a issue. A private function with such expect will also fail when its in --test

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

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties

Projects

None yet

Development

Successfully merging this pull request may close these issues.

In test builds, expect(clippy::missing_inline_in_public_items) does not function properly

8 participants