-
-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement trait_newly_sealed new lint #876
Implement trait_newly_sealed new lint #876
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent work — merging right away 🚀
Thank you for contributing 🙌
description: "A public trait became sealed, so users of this trait can not implement it anymore", | ||
required_update: Major, | ||
lint_level: Deny, | ||
reference_link: Some("https://rust-lang.github.io/api-guidelines/future-proofing.html#sealed-traits-protect-against-downstream-implementations-c-sealed"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a great reference link!
The current test cases are great. The lint tests cases are ones where we want to catch situations where the query in the lint itself might have a typo or a bug. If the engine running the query has misclassified a trait as sealed when it isn't (or vice versa), that's an upstream bug not a bug in the lint itself. We already have a large test suite of cursed sealed and "can't believe it's not sealed" trait patterns specifically to ensure our analysis of whether a trait is sealed remains accurate. This is one of the advantages of using Trustfall for a linter: you don't have to be an expert in "what are all the ways to seal a trait" in order to lint for sealed traits! We've already plugged in that knowledge into the query graph, and now it's accessible at the low low cost of writing a query 😁 |
Thanks so much for the encouragement on 'X', and the awesome code. Hope I can contribute further either here or |
Should contribute to #870 by adding trait becoming newly sealed lint. Welcome any feedback as I am by no means a rust expert and first time contributor here.
Edit: Not sure if there is a standard for the
reference_link
, assealed traits
didnt have a specific section. Also not sure if i am missing any cursed sealed impls, but welcome any newer ones that should be added.Thanks!