You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This allows one to declare that a trait is only used with internal types and should not be implemented by external users.
This has some benefits for keeping semver compatability. Codebases (like ICU4X) may wish to make this the default, just like you can already opt in to clippy::exhaustive_structs and clippy::exhaustive_enums to avoid committing to too much semver wise with public structs/enums. In a codebase with this lint enabled, every public non-sealed trait would have an allow ideally with justification.
The idea would be a lint clippy::unsealed_trait, which lints on traits which are:
Public
Reachable
Do not depend (transitively) on any trait named Sealed (we could also ignore the naming) that are not reachable from other crates
(perhaps) do not have a blanket impl for T
Transitivity might be tricky to do in a performant way.
The text was updated successfully, but these errors were encountered:
A pattern in Rust is "sealing" traits: making them unimplementable to other users. It's typically done by doing something like:
This allows one to declare that a trait is only used with internal types and should not be implemented by external users.
This has some benefits for keeping semver compatability. Codebases (like ICU4X) may wish to make this the default, just like you can already opt in to
clippy::exhaustive_structs
andclippy::exhaustive_enums
to avoid committing to too much semver wise with public structs/enums. In a codebase with this lint enabled, every public non-sealed trait would have anallow
ideally with justification.The idea would be a lint
clippy::unsealed_trait
, which lints on traits which are:Sealed
(we could also ignore the naming) that are not reachable from other cratesT
Transitivity might be tricky to do in a performant way.
The text was updated successfully, but these errors were encountered: