diff options
| author | bors <bors@rust-lang.org> | 2024-09-30 19:13:29 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-09-30 19:13:29 +0000 |
| commit | fb4aebddd18d258046ddb51fd41589295259a0fa (patch) | |
| tree | 9cf3e406a149c628a2cb34551d2e8d2ac5c82576 /src/librustdoc/html/static/js | |
| parent | 63a0bdd5622eaf6b9524702f055bb4525acfc9f2 (diff) | |
| parent | fd67755554100f47b11b70937690cd83319ffc7a (diff) | |
| download | rust-fb4aebddd18d258046ddb51fd41589295259a0fa.tar.gz rust-fb4aebddd18d258046ddb51fd41589295259a0fa.zip | |
Auto merge of #131069 - matthiaskrgr:rollup-jg1icf9, r=matthiaskrgr
Rollup of 5 pull requests
Successful merges:
- #131023 (Copy correct path to clipboard for modules/keywords/primitives)
- #131035 (Preserve brackets around if-lets and skip while-lets)
- #131038 (Fix `adt_const_params` leaking `{type error}` in error msg)
- #131053 (Improve `--print=check-cfg` documentation)
- #131056 (enable compiler fingerprint logs in verbose mode)
r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'src/librustdoc/html/static/js')
| -rw-r--r-- | src/librustdoc/html/static/js/main.js | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/librustdoc/html/static/js/main.js b/src/librustdoc/html/static/js/main.js index 0d556e0a682..984b0877d8d 100644 --- a/src/librustdoc/html/static/js/main.js +++ b/src/librustdoc/html/static/js/main.js @@ -1828,11 +1828,15 @@ href="https://doc.rust-lang.org/${channel}/rustdoc/read-documentation/search.htm return; } but.onclick = () => { - const path = []; - onEachLazy(document.querySelectorAll(".rustdoc-breadcrumbs a"), a => { - path.push(a.textContent); - }); - path.push(document.querySelector("title").textContent.split(" ")[0]); + // Most page titles are '<Item> in <path::to::module> - Rust', except + // modules (which don't have the first part) and keywords/primitives + // (which don't have a module path) + const title = document.querySelector("title").textContent.replace(" - Rust", ""); + const [item, module] = title.split(" in "); + const path = [item]; + if (module !== undefined) { + path.unshift(module); + } copyContentToClipboard(path.join("::")); copyButtonAnimation(but); |
