-
Notifications
You must be signed in to change notification settings - Fork 13.3k
rustdoc: Render [src] links for trait implementors #44920
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
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @QuietMisdreavus (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. |
Do you expect there to be tests in this PR? I'm going to assume "yes" and mark this as effectively a WIP. |
The last time i added The PR as-is seems to put the links in a place where the CSS isn't expecting to style them. This leaves them looking weird when adjacent to other src links, like here on Iterator: I'd like to get with @GuillaumeGomez to double-check what the best CSS change for this is, but I'm pretty sure that's all it will take to get these right. |
If this is required. |
Thanks for writing that test! The last thing i wanted to make sure this had was the CSS change we discussed on Gitter yesterday. @GuillaumeGomez suggested adding the following block to ul.item-list > li > .out-of-band {
font-size: 19px;
} And then changing the part that sets the |
I don't even see any css update. Did you forgot to push the file? |
Saw the messages, implemented the CSS change. |
Means "why not spaces"? Because of other indenting whitespace in this file is tabs. Continued list of targets which was split into mutiple lines is additionally indented to avoid blending with the rules part which is singly indented. |
A change suggested by @GuillaumeGomez and @QuietMisdreavus. Also slight reindenting of the appropriate CSS section.
b3b731d
to
67c9af5
Compare
Mainly because of I didn't notice a precedent of multi-line target line nearby and just did as I usually do. Fixed and re-pushed.
To allow assumption that each non-indented line is some section (oneline or multiline), not a continuation of something previous. But since non-indented style is already used elsewhere in the file, it's better to just follow it. |
|
||
// ignore-cross-compile | ||
|
||
#![crate_name = "foo"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove all unneeded empty lines in here (like in the impl
blocks).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which empty lines? Before and after the // ignore-corss-compile
? They are just retained from issue-34274.rs
, which served as a template. I don't think they should be removed (especially the first empty line).
like in the
impl
blocks
Means "and likewise remove them in impl blocks" or "like you did in impl blocks"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like this:
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-cross-compile
#![crate_name = "foo"]
pub trait SomeTrait {}
pub struct SomeStruct;
// @has foo/trait.SomeTrait.html '//a/@href' '../src/foo/issue-43893.rs.html#23-26'
impl SomeTrait for usize {}
// @has foo/trait.SomeTrait.html '//a/@href' '../src/foo/issue-43893.rs.html#29-32'
impl SomeTrait for SomeStruct {}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
impl SomeTrait for usize {}
{}
Other [src] link test (issue-34274.rs) tests for single line link. I thought it would be useful to also provide multiple line implementation, so that the link contains line range, not a single line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having multi-line tests is useful to make sure that the link points to the full span.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's why I contracted one impl to one line, but left the other impl as three lines in the update.
per @GuillaumeGomez's sample, but with one change.
@GuillaumeGomez, Done, but one impl is intentionally left as 3 lines instead of just |
Ok, then it's all good now. Thanks! @bors: r+ rollup |
📌 Commit acef039 has been approved by |
…omez rustdoc: Render [src] links for trait implementors Should close #43893. <s>No tests [yet].</s> r? @QuietMisdreavus
☀️ Test successful - status-appveyor, status-travis |
Should close #43893.
No tests [yet].r? @QuietMisdreavus