diff options
| author | Will Crichton <wcrichto@cs.stanford.edu> | 2021-05-30 10:00:44 -0700 |
|---|---|---|
| committer | Will Crichton <wcrichto@cs.stanford.edu> | 2021-10-06 19:44:50 -0700 |
| commit | 7831fee9f8c4409c80380c6ebed52ae267971438 (patch) | |
| tree | f98758403f5b92934cf50d72fe931304fa6325a9 /src/librustdoc/html | |
| parent | 4b3f82ad0321b8f2e2630b74bbc526ffb8fa5bda (diff) | |
| download | rust-7831fee9f8c4409c80380c6ebed52ae267971438.tar.gz rust-7831fee9f8c4409c80380c6ebed52ae267971438.zip | |
Fix check issue
Clean up tidy checks
Diffstat (limited to 'src/librustdoc/html')
| -rw-r--r-- | src/librustdoc/html/render/mod.rs | 2 | ||||
| -rw-r--r-- | src/librustdoc/html/static/css/rustdoc.css | 3 | ||||
| -rw-r--r-- | src/librustdoc/html/static/js/main.js | 21 |
3 files changed, 18 insertions, 8 deletions
diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index 0fb7723b68b..e83e085dc11 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -2466,7 +2466,7 @@ fn render_call_locations( let filtered_locations: Vec<_> = call_locations .iter() .filter_map(|(file, locs)| { - // TODO(wcrichto): file I/O should be cached + // FIXME(wcrichto): file I/O should be cached let mut contents = match fs::read_to_string(&file) { Ok(contents) => contents, Err(e) => { diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index ca8db4530f3..212362b94e0 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -1973,7 +1973,8 @@ details.undocumented[open] > summary::before { /* This part is for the new "examples" components */ -.scraped-example:not(.expanded) .code-wrapper pre.line-numbers, .scraped-example:not(.expanded) .code-wrapper .example-wrap pre.rust { +.scraped-example:not(.expanded) .code-wrapper pre.line-numbers, +.scraped-example:not(.expanded) .code-wrapper .example-wrap pre.rust { overflow: hidden; height: 240px; } diff --git a/src/librustdoc/html/static/js/main.js b/src/librustdoc/html/static/js/main.js index 5ac00ff244a..c6671623c23 100644 --- a/src/librustdoc/html/static/js/main.js +++ b/src/librustdoc/html/static/js/main.js @@ -1019,11 +1019,14 @@ function hideThemeButtonState() { var output = []; while (locs.length > 0 && lineIndex < codeLines.length) { - var lineLength = codeLines[lineIndex].length + 1; // +1 here and later is due to omitted \n + // +1 here and later is due to omitted \n + var lineLength = codeLines[lineIndex].length + 1; while (locs.length > 0 && totalOffset + lineLength > locs[0][0]) { var endIndex = lineIndex; var charsRemaining = locs[0][1] - totalOffset; - while (endIndex < codeLines.length && charsRemaining > codeLines[endIndex].length + 1) { + while (endIndex < codeLines.length && + charsRemaining > codeLines[endIndex].length + 1) + { charsRemaining -= codeLines[endIndex].length + 1; endIndex += 1; } @@ -1065,7 +1068,8 @@ function hideThemeButtonState() { var wrapper = elt.querySelector(".code-wrapper"); var halfHeight = wrapper.offsetHeight / 2; var lines = elt.querySelector('.line-numbers'); - var offsetMid = (lines.children[loc.from[0]].offsetTop + lines.children[loc.to[0]].offsetTop) / 2; + var offsetMid = (lines.children[loc.from[0]].offsetTop + + lines.children[loc.to[0]].offsetTop) / 2; var scrollOffset = offsetMid - halfHeight; lines.scrollTo(0, scrollOffset); elt.querySelector(".rust").scrollTo(0, scrollOffset); @@ -1093,7 +1097,9 @@ function hideThemeButtonState() { codeLines[loc.from[0]], litHtml[loc.from[0]], loc.from[1], - '<span class="highlight" data-loc="' + JSON.stringify(loc).replace(/"/g, """) + '">'); + '<span class="highlight" data-loc="' + + JSON.stringify(loc).replace(/"/g, """) + + '">'); }, true); // do this backwards to avoid shifting later offsets litParent.innerHTML = litHtml.join('\n'); @@ -1131,7 +1137,9 @@ function hideThemeButtonState() { function updateScrapedExamples() { onEach(document.getElementsByClassName('scraped-example-list'), function (exampleSet) { - updateScrapedExample(exampleSet.querySelector(".small-section-header + .scraped-example")); + updateScrapedExample( + exampleSet.querySelector(".small-section-header + .scraped-example") + ); }); onEach(document.getElementsByClassName("more-scraped-examples"), function (more) { @@ -1155,7 +1163,8 @@ function hideThemeButtonState() { this.querySelector('.inner').innerHTML = labelForToggleButton(false); if (!examples_init) { examples_init = true; - onEach(more.getElementsByClassName('scraped-example'), updateScrapedExample); + onEach(more.getElementsByClassName('scraped-example'), + updateScrapedExample); } } else { addClass(this, "collapsed"); |
