Skip to content

Conversation

AlisdairO
Copy link
Contributor

Noticed there wasn't an awful lot of info out there on using Any types, so added an example to the rustdocs.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The convention is to use //!

@AlisdairO
Copy link
Contributor Author

OK, I decided to just go with the simple match example in the end. Appreciate it if you could check the accuracy of my claim regarding Any and traits - I think it's correct, but I wouldn't want to lead people astray :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I broke the match onto separate lines like this to stay within the 80 character doc limit. Seems a bit less standard, though - any thoughts?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, the limit is no longer 80 but back to 100, or rather 99 (rust-lang/rust-guidelines#12).

@alexcrichton
Copy link
Member

Could you squash the two commits together as well? Other than that this looks good to go!

@AlisdairO
Copy link
Contributor Author

Done!

bors added a commit that referenced this pull request Jul 9, 2014
Noticed there wasn't an awful lot of info out there on using Any types, so added an example to the rustdocs.
@bors bors closed this Jul 9, 2014
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 21, 2023
…eykril

internal: post-bump lsp-server version
flip1995 pushed a commit to flip1995/rust that referenced this pull request Sep 4, 2025
Before this change, the suggestion for
`Option.or(Some(vec![])).unwrap()` expanded the `vec!` macro which broke
the code, both in terms of readability, and because the expansion
references `$crate` which cannot be inlined.

changelog: [`or_then_unwrap`]: Preserve macro calls rather than
expanding them

Relates to rust-lang/rust-clippy#6851
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.

5 participants