Skip to content
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

Discourage renaming in pub use re-exports #5

Closed
dtolnay opened this issue Apr 4, 2017 · 2 comments
Closed

Discourage renaming in pub use re-exports #5

dtolnay opened this issue Apr 4, 2017 · 2 comments

Comments

@dtolnay
Copy link
Member

dtolnay commented Apr 4, 2017

In flate2 the write/read/bufread modules all repeat the same type names:

pub use gz::EncoderReader as flate2::read::GzEncoder;
pub use deflate::EncoderReader as flate2::read::DeflateEncoder;

Unfortunately the rustdoc for flate2::read::GzEncoder shows the private names:

impl<R: Read> EncoderReader<R>
fn new(r: R, level: Compression) -> EncoderReader<R>

This is a rustdoc bug (rust-lang/rust#41072) but even aside from that, this pattern is confusing to people browsing the code because what they see clicking through a [src] link does not match how they will be using the library. Let's discourage renames in pub use unless there is a very good reason, and give an example of a very good reason from a high-quality crate.

@brson
Copy link
Contributor

brson commented Jun 30, 2017

Add to 'naming' or 'organization'.

@dtolnay
Copy link
Member Author

dtolnay commented Oct 29, 2017

I don't think this is a common enough problem to need a guideline.

@dtolnay dtolnay closed this as completed Oct 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants