diff options
| author | bors <bors@rust-lang.org> | 2022-07-04 06:35:29 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-07-04 06:35:29 +0000 |
| commit | 9c9ae85a4773be3c1e33717e4fa9759b4ce020ef (patch) | |
| tree | 8886c755c7b106b1fe4c1b566f5fb344a35e41a1 /src/librustdoc/html | |
| parent | a5c6a48aee84215a9200dfa1c4c6ad88f5721f56 (diff) | |
| parent | c41e2080de243ced3e02625a4f17af99c5e227a7 (diff) | |
| download | rust-9c9ae85a4773be3c1e33717e4fa9759b4ce020ef.tar.gz rust-9c9ae85a4773be3c1e33717e4fa9759b4ce020ef.zip | |
Auto merge of #98874 - matthiaskrgr:rollup-0u4hm54, r=matthiaskrgr
Rollup of 5 pull requests Successful merges: - #98501 (rustc_passes/src/entry.rs: De-duplicate more code with `fn throw_attr_err()`) - #98774 (rustdoc: make source sidebar toggle a real button) - #98806 (Fix long declaration trailing whitespace) - #98823 (Fix rust-call ICE in mir-inliner) - #98870 (Add regression test for #86784) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'src/librustdoc/html')
| -rw-r--r-- | src/librustdoc/html/format.rs | 12 | ||||
| -rw-r--r-- | src/librustdoc/html/static/css/rustdoc.css | 22 | ||||
| -rw-r--r-- | src/librustdoc/html/static/js/source-script.js | 6 |
3 files changed, 26 insertions, 14 deletions
diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index 056eda089c1..5584ecd287a 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -1283,10 +1283,6 @@ impl clean::FnDecl { let mut args = Buffer::html(); let mut args_plain = Buffer::new(); for (i, input) in self.inputs.values.iter().enumerate() { - if i == 0 { - args.push_str("<br>"); - } - if let Some(selfty) = input.to_self() { match selfty { clean::SelfValue => { @@ -1312,8 +1308,7 @@ impl clean::FnDecl { } } else { if i > 0 { - args.push_str(" <br>"); - args_plain.push_str(" "); + args.push_str("<br>"); } if input.is_const { args.push_str("const "); @@ -1360,13 +1355,14 @@ impl clean::FnDecl { let full_pad = format!("<br>{}", " ".repeat(indent + 4)); let close_pad = format!("<br>{}", " ".repeat(indent)); format!( - "({args}{close}){arrow}", + "({pad}{args}{close}){arrow}", + pad = if self.inputs.values.is_empty() { "" } else { &full_pad }, args = args.replace("<br>", &full_pad), close = close_pad, arrow = arrow ) } else { - format!("({args}){arrow}", args = args.replace("<br>", ""), arrow = arrow) + format!("({args}){arrow}", args = args.replace("<br>", " "), arrow = arrow) }; if f.alternate() { diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index ebff1dc92ea..8d99b85bebe 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -418,7 +418,7 @@ nav.sub { background-color: var(--sidebar-background-color); } -#sidebar-toggle:hover { +#sidebar-toggle > button:hover, #sidebar-toggle > button:focus { background-color: var(--sidebar-background-color-hover); } @@ -1401,7 +1401,6 @@ pre.rust { position: sticky; top: 0; left: 0; - cursor: pointer; font-weight: bold; font-size: 1.25rem; border-bottom: 1px solid; @@ -1422,7 +1421,24 @@ pre.rust { border-bottom: 1px solid; margin-bottom: 6px; } - +#sidebar-toggle > button { + background: none; + color: inherit; + cursor: pointer; + text-align: center; + border: none; + outline: none; + position: absolute; + top: 0; + bottom: 0; + left: 0; + right: 0; + /* work around button layout strangeness: https://stackoverflow.com/q/7271561 */ + width: 100%; + /* iOS button gradient: https://stackoverflow.com/q/5438567 */ + -webkit-appearance: none; + opacity: 1; +} #settings-menu, #help-button { margin-left: 4px; outline: none; diff --git a/src/librustdoc/html/static/js/source-script.js b/src/librustdoc/html/static/js/source-script.js index 9173e93e7c8..45e70c9a7c7 100644 --- a/src/librustdoc/html/static/js/source-script.js +++ b/src/librustdoc/html/static/js/source-script.js @@ -57,7 +57,7 @@ function createDirEntry(elem, parent, fullPath, hasFoundFile) { } function toggleSidebar() { - const child = this.children[0]; + const child = this.parentNode.children[0]; if (child.innerText === ">") { if (window.innerWidth < 701) { // This is to keep the scroll position on mobile. @@ -86,15 +86,15 @@ function toggleSidebar() { function createSidebarToggle() { const sidebarToggle = document.createElement("div"); sidebarToggle.id = "sidebar-toggle"; - sidebarToggle.onclick = toggleSidebar; - const inner = document.createElement("div"); + const inner = document.createElement("button"); if (getCurrentValue("source-sidebar-show") === "true") { inner.innerText = "<"; } else { inner.innerText = ">"; } + inner.onclick = toggleSidebar; sidebarToggle.appendChild(inner); return sidebarToggle; |
