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
Kixunil opened this issue
Jun 15, 2018
· 1 comment
Labels
A-lintArea: New lintsE-hardCall for participation: This a hard problem and requires more experience or effort to work onL-styleLint: Belongs in the style lint group
The problem with this crate is that in order to use it, a user must explicitly add byteorder crate to dependencies, which is annoying. However, if the crate had pub extern crate byteorder; or re-exported byteorder::{ByteOrder, LE, BE}, no additional definitions would be necessary.
So I suggest to detect instances of usage of types from dependencies in interfaces and warn if they aren't public/re-exported.
Of course, there is a difficulty with traits used like in this example (re-exporting byteorder::ByteOrder isn't enough but there is nothing in the interface of the deserialize method to suggest that). One way to address it would be suggesting to either make the whole dependency public or re-export all public types implementing that trait.
What do you think?
The text was updated successfully, but these errors were encountered:
It might be useful to also reexport features of libraries that appear in the interface. Can clippy look at Cargo.toml?
flip1995
added
L-style
Lint: Belongs in the style lint group
E-hard
Call for participation: This a hard problem and requires more experience or effort to work on
A-lint
Area: New lints
labels
Dec 2, 2020
A-lintArea: New lintsE-hardCall for participation: This a hard problem and requires more experience or effort to work onL-styleLint: Belongs in the style lint group
I think this suggestion can be best explained with an example. Suppose we have a library crate with this
lib.rs
The problem with this crate is that in order to use it, a user must explicitly add
byteorder
crate to dependencies, which is annoying. However, if the crate hadpub extern crate byteorder;
or re-exportedbyteorder::{ByteOrder, LE, BE}
, no additional definitions would be necessary.So I suggest to detect instances of usage of types from dependencies in interfaces and warn if they aren't public/re-exported.
Of course, there is a difficulty with traits used like in this example (re-exporting
byteorder::ByteOrder
isn't enough but there is nothing in the interface of thedeserialize
method to suggest that). One way to address it would be suggesting to either make the whole dependency public or re-export all public types implementing that trait.What do you think?
The text was updated successfully, but these errors were encountered: