From 01756e270796a9e44dc6b655553358f05d00ad40 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Mon, 11 Sep 2023 15:07:44 -0700 Subject: [PATCH] rustdoc: use functions instead of unnecessary arrows --- src/librustdoc/html/static/js/main.js | 28 +++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/librustdoc/html/static/js/main.js b/src/librustdoc/html/static/js/main.js index a05dfe4d3e14..8fbfb783921b 100644 --- a/src/librustdoc/html/static/js/main.js +++ b/src/librustdoc/html/static/js/main.js @@ -1246,7 +1246,7 @@ href="https://doc.rust-lang.org/${channel}/rustdoc/how-to-read-rustdoc.html\ return; } const isSrcPage = hasClass(document.body, "src"); - const hideSidebar = () => { + function hideSidebar() { if (isSrcPage) { window.rustdocCloseSourceSidebar(); updateLocalStorage("src-sidebar-width", null); @@ -1257,16 +1257,16 @@ href="https://doc.rust-lang.org/${channel}/rustdoc/how-to-read-rustdoc.html\ updateLocalStorage("desktop-sidebar-width", null); document.documentElement.style.removeProperty("--desktop-sidebar-width"); } - }; - const showSidebar = () => { + } + function showSidebar() { if (isSrcPage) { window.rustdocShowSourceSidebar(); } else { removeClass(document.documentElement, "hide-sidebar"); updateLocalStorage("hide-sidebar", "false"); } - }; - const changeSidebarSize = size => { + } + function changeSidebarSize(size) { if (isSrcPage) { updateLocalStorage("src-sidebar-width", size); document.documentElement.style.setProperty("--src-sidebar-width", size + "px"); @@ -1274,13 +1274,13 @@ href="https://doc.rust-lang.org/${channel}/rustdoc/how-to-read-rustdoc.html\ updateLocalStorage("desktop-sidebar-width", size); document.documentElement.style.setProperty("--desktop-sidebar-width", size + "px"); } - }; - const isSidebarHidden = () => { + } + function isSidebarHidden() { return isSrcPage ? !hasClass(document.documentElement, "src-sidebar-expanded") : hasClass(document.documentElement, "hide-sidebar"); - }; - const resize = e => { + } + function resize(e) { if (currentPointerId === null || currentPointerId !== e.pointerId) { return; } @@ -1296,8 +1296,8 @@ href="https://doc.rust-lang.org/${channel}/rustdoc/how-to-read-rustdoc.html\ } changeSidebarSize(Math.min(pos, window.innerWidth - 100)); } - }; - const stopResize = e => { + } + function stopResize(e) { if (currentPointerId === null) { return; } @@ -1310,8 +1310,8 @@ href="https://doc.rust-lang.org/${channel}/rustdoc/how-to-read-rustdoc.html\ resizer.releasePointerCapture(currentPointerId); currentPointerId = null; } - }; - const initResize = e => { + } + function initResize(e) { if (currentPointerId !== null || e.altKey || e.ctrlKey || e.metaKey || e.button !== 0) { return; } @@ -1331,7 +1331,7 @@ href="https://doc.rust-lang.org/${channel}/rustdoc/how-to-read-rustdoc.html\ window.addEventListener("pointerup", stopResize, false); addClass(resizer, "active"); addClass(document.documentElement, "sidebar-resizing"); - }; + } resizer.addEventListener("pointerdown", initResize, false); }());