Skip to content

Commit 3768ec0

Browse files
committed
Auto merge of #158058 - jhpratt:rollup-JemlzIR, r=jhpratt
Rollup of 2 pull requests Successful merges: - #158049 (rustdoc: remove more @ts-expect-error from main.js) - #158005 (Remove useless `#[doc(hidden)]` from `ZipImpl`)
2 parents f7da3c0 + 8193ee6 commit 3768ec0

2 files changed

Lines changed: 12 additions & 21 deletions

File tree

  • library/core/src/iter/adapters
  • src/librustdoc/html/static/js

library/core/src/iter/adapters/zip.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ where
125125
}
126126

127127
// Zip specialization trait
128-
#[doc(hidden)]
129128
trait ZipImpl<A, B> {
130129
type Item;
131130
fn new(a: A, b: B) -> Self;
@@ -204,7 +203,6 @@ macro_rules! zip_impl_general_defaults {
204203
}
205204

206205
// General Zip impl
207-
#[doc(hidden)]
208206
impl<A, B> ZipImpl<A, B> for Zip<A, B>
209207
where
210208
A: Iterator,
@@ -247,7 +245,6 @@ where
247245
}
248246
}
249247

250-
#[doc(hidden)]
251248
impl<A, B> ZipImpl<A, B> for Zip<A, B>
252249
where
253250
A: TrustedRandomAccessNoCoerce + Iterator,
@@ -288,7 +285,6 @@ where
288285
}
289286
}
290287

291-
#[doc(hidden)]
292288
impl<A, B> ZipImpl<A, B> for Zip<A, B>
293289
where
294290
A: TrustedRandomAccess + Iterator,

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

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ function getOrCreateSection(id, classes) {
117117
el = document.createElement("section");
118118
el.id = id;
119119
el.className = classes;
120+
// MAIN_ID exists, and is not the root
120121
// @ts-expect-error
121122
insertAfter(el, document.getElementById(MAIN_ID));
122123
}
@@ -154,8 +155,7 @@ function switchDisplayedElement(elemToDisplay) {
154155
const el = getAlternativeDisplayElem();
155156

156157
if (el.children.length > 0) {
157-
// @ts-expect-error
158-
getNotDisplayedElem().appendChild(el.firstElementChild);
158+
getNotDisplayedElem().appendChild(nonnull(el.firstElementChild));
159159
}
160160
if (elemToDisplay === null) {
161161
addClass(el, "hidden");
@@ -202,7 +202,7 @@ function preLoadCss(cssUrl) {
202202
/**
203203
* Run a JavaScript file asynchronously.
204204
* @param {string} url
205-
* @param {function(): any} errorCallback
205+
* @param {function(): any} [errorCallback]
206206
*/
207207
function loadScript(url, errorCallback) {
208208
const script = document.createElement("script");
@@ -224,7 +224,6 @@ function preLoadCss(cssUrl) {
224224
event.preventDefault();
225225
// Sending request for the CSS and the JS files at the same time so it will
226226
// hopefully be loaded when the JS will generate the settings content.
227-
// @ts-expect-error
228227
loadScript(getVar("static-root-path") + getVar("settings-js"));
229228
// Pre-load all theme CSS files, so that switching feels seamless.
230229
//
@@ -811,6 +810,7 @@ function preLoadCss(cssUrl) {
811810
}
812811
const implementors = implementorsElems("implementors-list");
813812
const syntheticImplementors = implementorsElems("synthetic-implementors-list");
813+
/** @type {Set<string>} */
814814
const inlined_types = new Set();
815815

816816
const TEXT_IDX = 0;
@@ -829,17 +829,14 @@ function preLoadCss(cssUrl) {
829829
if (!aliases) {
830830
return;
831831
}
832-
// @ts-expect-error
833-
aliases.split(",").forEach(alias => {
832+
aliases.split(",").forEach(/** @param {string} alias */ alias => {
834833
inlined_types.add(alias);
835834
});
836835
});
837836
}
838837

839-
// @ts-expect-error
840-
let currentNbImpls = implementors[0].getElementsByClassName("impl").length;
841-
// @ts-expect-error
842-
const traitName = document.querySelector(".main-heading h1 > .trait").textContent;
838+
let currentNbImpls = nonnull(implementors[0]).getElementsByClassName("impl").length;
839+
const traitName = nonnull(document.querySelector(".main-heading h1 > .trait")).textContent;
843840
const baseIdName = "impl-" + traitName + "-";
844841
const libs = Object.getOwnPropertyNames(imp);
845842
// We don't want to include impls from this JS file, when the HTML already has them.
@@ -859,7 +856,8 @@ function preLoadCss(cssUrl) {
859856

860857
struct_loop:
861858
for (const struct of structs) {
862-
const list = struct[SYNTHETIC_IDX] ? syntheticImplementors : implementors;
859+
const [impList, negImpMarker] =
860+
struct[SYNTHETIC_IDX] ? syntheticImplementors : implementors;
863861

864862
// The types list is only used for synthetic impls.
865863
// If this changes, `main.js` and `write_shared.rs` both need changed.
@@ -898,11 +896,9 @@ function preLoadCss(cssUrl) {
898896
// If this is a negative implementor, we put it into the right location (just
899897
// before the negative impl marker).
900898
if (struct[IS_NEG_IDX]) {
901-
// @ts-expect-error
902-
list[1].before(display);
899+
nonnull(negImpMarker).before(display);
903900
} else {
904-
// @ts-expect-error
905-
list[0].appendChild(display);
901+
nonnull(impList).appendChild(display);
906902
}
907903
currentNbImpls += 1;
908904
}
@@ -978,8 +974,7 @@ function preLoadCss(cssUrl) {
978974
const text = impList[0];
979975
const traitName = impList[1];
980976
const isTrait = typeof traitName === "string";
981-
// @ts-expect-error
982-
if (types.indexOf(selfPath) === -1) {
977+
if (selfPath === null || types.indexOf(selfPath) === -1) {
983978
continue;
984979
}
985980
let outputList = isTrait ? trait_implementations : implementations;

0 commit comments

Comments
 (0)