Skip to content

docs: Update multiple file use statement example #13960

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

Merged
merged 1 commit into from
May 6, 2014

Conversation

brandonw
Copy link
Contributor

@brandonw brandonw commented May 6, 2014

Update the example to make the usage of pub mod foo; much more
apparent, as well as using an example where setting the visibility of
the module is actually necessary.

@brandonw brandonw changed the title Update multiple file use statement example docs: Update multiple file use statement example May 6, 2014
@alexcrichton
Copy link
Member

This appears to have legitimate errors on travis

Update the example to make the usage of `pub mod foo;` much more
apparent, as well as using an example where setting the visibility of
the module is actually necessary.
@brandonw
Copy link
Contributor Author

brandonw commented May 6, 2014

Do you know what "visibility has no effect inside functions" means in the context of the 3rd snippet of rust code in this pull request? Nothing looked out of the ordinary, and when I tried compiling the code locally it had no problems.

Either way, the first two code snippets were already ignored, so I ignored the third one as well. If you want to have them all not ignored, let me know and I will make the fix.

@alexcrichton
Copy link
Member

By default, rustdoc will wrap all code snippets in fn main() { /* code snippet */ } so any visibility you place on functions will qualify as putting visibility on functions in functions (disallowed).

You can mitigate the effects with a doc block that looks like:

pub fn foo() {
   // example code
}
# fn main() {} // disable rustdoc injection, also don't show this line.

@brandonw
Copy link
Contributor Author

brandonw commented May 6, 2014

Ah, thanks for that tip. I will keep that in mind for future documentation pull requests.

bors added a commit that referenced this pull request May 6, 2014
Update the example to make the usage of `pub mod foo;` much more
apparent, as well as using an example where setting the visibility of
the module is actually necessary.
@bors bors closed this May 6, 2014
@bors bors merged commit 949143e into rust-lang:master May 6, 2014
flip1995 pushed a commit to flip1995/rust that referenced this pull request Feb 27, 2025
…mes` (rust-lang#13960)

Fixes rust-lang/rust-clippy#13514

changelog: Added [`elidable_lifetime_names`] to `pedantic` (Split off
from [`needless_lifetime`] for suggestions with `'_`)
[rust-lang#13960](rust-lang/rust-clippy#13960)

changelog: Enhancement: [`needless_lifetime`] No longer lints for
elidable lifetimes `'_`, use [`elidable_lifetime_names`] to lint these.
[rust-lang#13960](rust-lang/rust-clippy#13960)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants