Uh oh!
There was an error while loading. Please reload this page.
Minor librustdoc cleanup and refactoring. - #36903
Conversation
rust-highfive
commented
Oct 2, 2016
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @steveklabnik (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
frewsxcv
commented
Oct 2, 2016
frewsxcv
commented
Oct 2, 2016
I need a sanity check for 19f6130 Here's the new print function it will use: rust/src/librustc/hir/print.rs Lines 273 to 275 in df9fa1a rust/src/librustc/hir/print.rs Lines 1615 to 1636 in df9fa1a |
| CLikeVariant | ||
| } else { | ||
| TupleVariant(struct_def.fields().iter().map(|x| x.ty.clean(cx)).collect()) | ||
| impl VariantKind { |
There was a problem hiding this comment.
Could you make this an implementation of Clean<VariantKind> for hir::VariantData?
There was a problem hiding this comment.
d6fb0c8d6a01beab132f1df7832794401ac92a46
| PatKind::Wild => "_".to_string(), | ||
| PatKind::Binding(_, ref p, _) => p.node.to_string(), | ||
| PatKind::TupleStruct(ref p, ..) | PatKind::Path(None, ref p) => path_to_string(p), | ||
| PatKind::TupleStruct(ref p, ..) | PatKind::Path(None, ref p) => p.to_string(), |
There was a problem hiding this comment.
hir::print::State::print_path begins with self.maybe_print_comment(path.span.lo), which might actually print a comment in this case:
fnf(arg1:(),// Some comment
path::to::TupleStruct(x): path::to::TupleStruct){//^ The `name_from_pat` of this tuple struct pattern might include "// Some comment"}There was a problem hiding this comment.
Do you think I should add an parameter to that function to control whether the comment gets printed or just ditch that commit?
There was a problem hiding this comment.
I'd probably ditch the commit to be on the safe side since I don't understand the pretty printer, especially in edge cases (e.g. it might emit newlines and indents in long patterns).
There was a problem hiding this comment.
nit: this can fit on one line
There was a problem hiding this comment.
nit: this can fit on one line
There was a problem hiding this comment.
nit: this would be easier for me to read:
iflet clean::VariantItem(Variant{kind:VariantKind::Struct(ref s)}) =
variant.inner{There was a problem hiding this comment.
or
iflet clean::VariantItem(Variant{kind:VariantKind::Struct(ref s)}) = variant.inner{frewsxcv
commented
Oct 3, 2016
Latest force push removes 19f6130 and makes the suggested style changes. |
jseyfried
commented
Oct 3, 2016
Thanks! @bors r+ |
bors
commented
Oct 3, 2016
📌 Commit 35d214a has been approved by |
Minor librustdoc cleanup and refactoring.
No description provided.