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

[rustdoc] Copy only item path to clipboard rather than full use statement. #87178

Merged
merged 1 commit into from
Aug 17, 2021

Conversation

moxian
Copy link
Contributor

@moxian moxian commented Jul 16, 2021

The (somewhat) recent addition of the "copy item import to clipboard" button is extremely nice.

However, i tend to write my code with fully qualified paths wherever feasible and only resort to use statements as a refactoring pass. This makes the "copy to clipboard" workflow awkward to use, as i would be copy-pasting that as, say

impl use std::ops::Add; for MyType {

and then go back and remove the use and ;.

This PR removes the use ; decorations, making it much nicer to use for fully-qualified items. I argue, however, that this does not noticeably degrade experience for those who prefer to import items, since the hard part about those is getting the path right, and writing the use ; decoration can be done by hand with little effort.

@rust-highfive
Copy link
Collaborator

Some changes occurred in HTML/CSS/JS.

cc @GuillaumeGomez

@rust-highfive
Copy link
Collaborator

r? @ollie27

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 16, 2021
@GuillaumeGomez GuillaumeGomez added A-rustdoc-js Area: Rustdoc's front-end T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Jul 16, 2021
@GuillaumeGomez
Copy link
Member

For reference, it was added in #83721. As you can see from the original issue, it was explicitly asked to also copy the use statement. Personally I'm fine with both though. What do you think @rust-lang/rustdoc ?

@moxian
Copy link
Contributor Author

moxian commented Jul 16, 2021

Ah, my bad! I did find #83721 but indeed failed to navigate to the original request! So I assumed that was your personal initiative.

Should I (have) file(d) an issue for this for broader discussion? (I'm not sure how these things should be organized, sorry)

@GuillaumeGomez
Copy link
Member

It's fine. We can debate here too, don't worry.

@Manishearth
Copy link
Member

I think I would prefer to just copy the path yeah.

@JohnCSimon JohnCSimon added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 31, 2021
@jyn514
Copy link
Member

jyn514 commented Aug 16, 2021

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Aug 16, 2021

📌 Commit 81d792f has been approved by jyn514

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 16, 2021
m-ou-se added a commit to m-ou-se/rust that referenced this pull request Aug 16, 2021
[rustdoc] Copy only item path to clipboard rather than full `use` statement.

The (somewhat) recent addition of the "copy item import to clipboard" button is extremely nice.

However, i tend to write my code with fully qualified paths wherever feasible and only resort to `use` statements as a refactoring pass. This makes the "copy to clipboard" workflow awkward to use, as i would be copy-pasting that as, say

```rust
impl use std::ops::Add; for MyType {
```

and then go back  and remove the `use ` and `;`.

This PR removes the `use ;` decorations, making it much nicer to use for fully-qualified items. I argue, however, that this does not noticeably degrade experience for those who prefer to import items, since the hard part about those is getting the path right, and writing the `use ;` decoration can be done by hand with little effort.
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 16, 2021
Rollup of 10 pull requests

Successful merges:

 - rust-lang#87178 ([rustdoc] Copy only item path to clipboard rather than full `use` statement.)
 - rust-lang#87677 (Adding explicit notice of lack of documentation for Tier 2 Platforms)
 - rust-lang#87958 (Closure migration multispan suggestions)
 - rust-lang#87967 (Detect fake spans in non_fmt_panic lint.)
 - rust-lang#88011 (Enable `--all-targets` for `x.py check` unconditionally)
 - rust-lang#88030 (Assign FIXMEs to me and remove obsolete ones)
 - rust-lang#88052 (Update redox_syscall)
 - rust-lang#88055 (Update RELEASES.md for 1.55.0)
 - rust-lang#88080 (Skip assert ICE with default_method_body_is_const)
 - rust-lang#88089 (Rustdoc font test)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 2dbb2f7 into rust-lang:master Aug 17, 2021
@rustbot rustbot added this to the 1.56.0 milestone Aug 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rustdoc-js Area: Rustdoc's front-end S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants