Skip to content

Commit 7831fee

Browse files
committed
Fix check issue
Clean up tidy checks
1 parent 4b3f82a commit 7831fee

File tree

5 files changed

+24
-14
lines changed

5 files changed

+24
-14
lines changed

src/librustdoc/html/render/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2466,7 +2466,7 @@ fn render_call_locations(
24662466
let filtered_locations: Vec<_> = call_locations
24672467
.iter()
24682468
.filter_map(|(file, locs)| {
2469-
// TODO(wcrichto): file I/O should be cached
2469+
// FIXME(wcrichto): file I/O should be cached
24702470
let mut contents = match fs::read_to_string(&file) {
24712471
Ok(contents) => contents,
24722472
Err(e) => {

src/librustdoc/html/static/css/rustdoc.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1973,7 +1973,8 @@ details.undocumented[open] > summary::before {
19731973

19741974
/* This part is for the new "examples" components */
19751975

1976-
.scraped-example:not(.expanded) .code-wrapper pre.line-numbers, .scraped-example:not(.expanded) .code-wrapper .example-wrap pre.rust {
1976+
.scraped-example:not(.expanded) .code-wrapper pre.line-numbers,
1977+
.scraped-example:not(.expanded) .code-wrapper .example-wrap pre.rust {
19771978
overflow: hidden;
19781979
height: 240px;
19791980
}

src/librustdoc/html/static/js/main.js

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,11 +1019,14 @@ function hideThemeButtonState() {
10191019
var output = [];
10201020

10211021
while (locs.length > 0 && lineIndex < codeLines.length) {
1022-
var lineLength = codeLines[lineIndex].length + 1; // +1 here and later is due to omitted \n
1022+
// +1 here and later is due to omitted \n
1023+
var lineLength = codeLines[lineIndex].length + 1;
10231024
while (locs.length > 0 && totalOffset + lineLength > locs[0][0]) {
10241025
var endIndex = lineIndex;
10251026
var charsRemaining = locs[0][1] - totalOffset;
1026-
while (endIndex < codeLines.length && charsRemaining > codeLines[endIndex].length + 1) {
1027+
while (endIndex < codeLines.length &&
1028+
charsRemaining > codeLines[endIndex].length + 1)
1029+
{
10271030
charsRemaining -= codeLines[endIndex].length + 1;
10281031
endIndex += 1;
10291032
}
@@ -1065,7 +1068,8 @@ function hideThemeButtonState() {
10651068
var wrapper = elt.querySelector(".code-wrapper");
10661069
var halfHeight = wrapper.offsetHeight / 2;
10671070
var lines = elt.querySelector('.line-numbers');
1068-
var offsetMid = (lines.children[loc.from[0]].offsetTop + lines.children[loc.to[0]].offsetTop) / 2;
1071+
var offsetMid = (lines.children[loc.from[0]].offsetTop
1072+
+ lines.children[loc.to[0]].offsetTop) / 2;
10691073
var scrollOffset = offsetMid - halfHeight;
10701074
lines.scrollTo(0, scrollOffset);
10711075
elt.querySelector(".rust").scrollTo(0, scrollOffset);
@@ -1093,7 +1097,9 @@ function hideThemeButtonState() {
10931097
codeLines[loc.from[0]],
10941098
litHtml[loc.from[0]],
10951099
loc.from[1],
1096-
'<span class="highlight" data-loc="' + JSON.stringify(loc).replace(/"/g, "&quot;") + '">');
1100+
'<span class="highlight" data-loc="' +
1101+
JSON.stringify(loc).replace(/"/g, "&quot;") +
1102+
'">');
10971103
}, true); // do this backwards to avoid shifting later offsets
10981104
litParent.innerHTML = litHtml.join('\n');
10991105

@@ -1131,7 +1137,9 @@ function hideThemeButtonState() {
11311137

11321138
function updateScrapedExamples() {
11331139
onEach(document.getElementsByClassName('scraped-example-list'), function (exampleSet) {
1134-
updateScrapedExample(exampleSet.querySelector(".small-section-header + .scraped-example"));
1140+
updateScrapedExample(
1141+
exampleSet.querySelector(".small-section-header + .scraped-example")
1142+
);
11351143
});
11361144

11371145
onEach(document.getElementsByClassName("more-scraped-examples"), function (more) {
@@ -1155,7 +1163,8 @@ function hideThemeButtonState() {
11551163
this.querySelector('.inner').innerHTML = labelForToggleButton(false);
11561164
if (!examples_init) {
11571165
examples_init = true;
1158-
onEach(more.getElementsByClassName('scraped-example'), updateScrapedExample);
1166+
onEach(more.getElementsByClassName('scraped-example'),
1167+
updateScrapedExample);
11591168
}
11601169
} else {
11611170
addClass(this, "collapsed");

src/librustdoc/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ fn opts() -> Vec<RustcOptGroup> {
620620
)
621621
}),
622622
unstable("scrape-examples", |o| o.optmulti("", "scrape-examples", "", "")),
623-
unstable("repository-url", |o| o.optopt("", "repository-url", "", "TODO")),
623+
unstable("repository-url", |o| o.optopt("", "repository-url", "", "")),
624624
]
625625
}
626626

src/librustdoc/scrape_examples.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use rustc_hir::{
99
};
1010
use rustc_interface::interface;
1111
use rustc_middle::hir::map::Map;
12-
use rustc_middle::ty::{TyCtxt, TyKind};
12+
use rustc_middle::ty::{self, TyCtxt};
1313
use rustc_span::symbol::Symbol;
1414

1515
crate type FnCallLocations = FxHashMap<String, Vec<(usize, usize)>>;
@@ -60,7 +60,7 @@ where
6060
};
6161

6262
// Save call site if the function resovles to a concrete definition
63-
if let TyKind::FnDef(def_id, _) = ty.kind() {
63+
if let ty::FnDef(def_id, _) = ty.kind() {
6464
if self.tcx.crate_name(def_id.krate) == self.krate {
6565
let key = self.tcx.def_path(*def_id).to_string_no_crate_verbose();
6666
let entries = self.calls.entry(key).or_insert_with(FxHashMap::default);
@@ -107,16 +107,16 @@ impl rustc_driver::Callbacks for Callbacks {
107107
/// * `krate` is the name of the crate being documented.
108108
pub fn scrape(examples: &[String], krate: &str) -> interface::Result<AllCallLocations> {
109109
// Scrape each crate in parallel
110-
// TODO(wcrichto): do we need optional support for no rayon?
110+
// FIXME(wcrichto): do we need optional support for no rayon?
111111
let maps = examples
112112
.par_iter()
113113
.map(|example| {
114-
// TODO(wcrichto): is there a more robust way to get arguments than split(" ")?
114+
// FIXME(wcrichto): is there a more robust way to get arguments than split(" ")?
115115
let mut args = example.split(" ").map(|s| s.to_owned()).collect::<Vec<_>>();
116116
let file_name = args[0].clone();
117117
args.insert(0, "_".to_string());
118118

119-
// TODO(wcrichto): is there any setup / cleanup that needs to be performed
119+
// FIXME(wcrichto): is there any setup / cleanup that needs to be performed
120120
// here upon the invocation of rustc_driver?
121121
debug!("Scraping examples from krate {} with args:\n{:?}", krate, args);
122122
let mut callbacks =

0 commit comments

Comments
 (0)