about summary refs log tree commit diff
path: root/src/librustdoc/html/render
diff options
context:
space:
mode:
authorMara Bos <m-ou.se@m-ou.se>2021-08-16 23:37:25 +0200
committerGitHub <noreply@github.com>2021-08-16 23:37:25 +0200
commit2dbb2f7420e72c848d71dcdf61e2a1117d97cc5d (patch)
treebac9aae1e926e47b3839bca2ed921e23afdb368a /src/librustdoc/html/render
parent0035d9dcecee49d1f7349932bfa52c05a6f83641 (diff)
parent81d792f31d02ac461f5ea3f9f65f14cfc95a0e6f (diff)
downloadrust-2dbb2f7420e72c848d71dcdf61e2a1117d97cc5d.tar.gz
rust-2dbb2f7420e72c848d71dcdf61e2a1117d97cc5d.zip
Rollup merge of #87178 - moxian:rd-use, r=jyn514
[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.
Diffstat (limited to 'src/librustdoc/html/render')
-rw-r--r--src/librustdoc/html/render/print_item.rs5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/librustdoc/html/render/print_item.rs b/src/librustdoc/html/render/print_item.rs
index f31305c76e6..a3b01a59f27 100644
--- a/src/librustdoc/html/render/print_item.rs
+++ b/src/librustdoc/html/render/print_item.rs
@@ -85,11 +85,10 @@ pub(super) fn print_item(cx: &Context<'_>, item: &clean::Item, buf: &mut Buffer,
     write!(buf, "<a class=\"{}\" href=\"#\">{}</a>", item.type_(), item.name.as_ref().unwrap());
     write!(
         buf,
-        "<button id=\"copy-path\" onclick=\"copy_path(this)\" title=\"copy path\">\
+        "<button id=\"copy-path\" onclick=\"copy_path(this)\" title=\"Copy item path to clipboard\">\
             <img src=\"{static_root_path}clipboard{suffix}.svg\" \
                 width=\"19\" height=\"18\" \
-                alt=\"Copy item import\" \
-                title=\"Copy item import to clipboard\">\
+                alt=\"Copy item path\">\
          </button>",
         static_root_path = page.get_static_root_path(),
         suffix = page.resource_suffix,