From a8f468f5c6b1b0857a00ecacf0934e39bd8e8a79 Mon Sep 17 00:00:00 2001 From: Takayuki Maeda Date: Mon, 26 Dec 2022 15:01:20 +0900 Subject: [PATCH 1/3] remove unused imports --- .../rustc_hir_analysis/src/impl_wf_check/min_specialization.rs | 1 - compiler/rustc_middle/src/mir/terminator.rs | 2 +- compiler/rustc_middle/src/ty/walk.rs | 2 +- compiler/rustc_parse/src/parser/diagnostics.rs | 1 - compiler/rustc_parse/src/parser/item.rs | 1 - compiler/rustc_trait_selection/src/traits/util.rs | 1 - 6 files changed, 2 insertions(+), 6 deletions(-) diff --git a/compiler/rustc_hir_analysis/src/impl_wf_check/min_specialization.rs b/compiler/rustc_hir_analysis/src/impl_wf_check/min_specialization.rs index fd8e8ed7ba605..ef0ffd2ec51c9 100644 --- a/compiler/rustc_hir_analysis/src/impl_wf_check/min_specialization.rs +++ b/compiler/rustc_hir_analysis/src/impl_wf_check/min_specialization.rs @@ -81,7 +81,6 @@ use rustc_span::Span; use rustc_trait_selection::traits::error_reporting::TypeErrCtxtExt; use rustc_trait_selection::traits::outlives_bounds::InferCtxtExt as _; use rustc_trait_selection::traits::{self, translate_substs, wf, ObligationCtxt}; -use tracing::instrument; pub(super) fn check_min_specialization(tcx: TyCtxt<'_>, impl_def_id: LocalDefId) { if let Some(node) = parent_specialization_node(tcx, impl_def_id) { diff --git a/compiler/rustc_middle/src/mir/terminator.rs b/compiler/rustc_middle/src/mir/terminator.rs index 013a1bccd3bd1..438f36373ca91 100644 --- a/compiler/rustc_middle/src/mir/terminator.rs +++ b/compiler/rustc_middle/src/mir/terminator.rs @@ -1,4 +1,4 @@ -use smallvec::{smallvec, SmallVec}; +use smallvec::SmallVec; use super::{BasicBlock, InlineAsmOperand, Operand, SourceInfo, TerminatorKind}; use rustc_ast::InlineAsmTemplatePiece; diff --git a/compiler/rustc_middle/src/ty/walk.rs b/compiler/rustc_middle/src/ty/walk.rs index 34dbb6e9f68ea..708a5e4d059e8 100644 --- a/compiler/rustc_middle/src/ty/walk.rs +++ b/compiler/rustc_middle/src/ty/walk.rs @@ -4,7 +4,7 @@ use crate::ty::subst::{GenericArg, GenericArgKind}; use crate::ty::{self, Ty}; use rustc_data_structures::sso::SsoHashSet; -use smallvec::{self, SmallVec}; +use smallvec::SmallVec; // The TypeWalker's stack is hot enough that it's worth going to some effort to // avoid heap allocations. diff --git a/compiler/rustc_parse/src/parser/diagnostics.rs b/compiler/rustc_parse/src/parser/diagnostics.rs index 0191ab730c812..61fe379c3e98b 100644 --- a/compiler/rustc_parse/src/parser/diagnostics.rs +++ b/compiler/rustc_parse/src/parser/diagnostics.rs @@ -41,7 +41,6 @@ use rustc_span::{Span, SpanSnippetError, DUMMY_SP}; use std::mem::take; use std::ops::{Deref, DerefMut}; use thin_vec::{thin_vec, ThinVec}; -use tracing::{debug, trace}; /// Creates a placeholder argument. pub(super) fn dummy_arg(ident: Ident) -> Param { diff --git a/compiler/rustc_parse/src/parser/item.rs b/compiler/rustc_parse/src/parser/item.rs index 7c2d01509de41..9b8a6c47966d4 100644 --- a/compiler/rustc_parse/src/parser/item.rs +++ b/compiler/rustc_parse/src/parser/item.rs @@ -24,7 +24,6 @@ use rustc_span::symbol::{kw, sym, Ident, Symbol}; use rustc_span::DUMMY_SP; use std::mem; use thin_vec::ThinVec; -use tracing::debug; impl<'a> Parser<'a> { /// Parses a source module as a crate. This is the main entry point for the parser. diff --git a/compiler/rustc_trait_selection/src/traits/util.rs b/compiler/rustc_trait_selection/src/traits/util.rs index f3ca6a6c779a0..b5df583e3f4cb 100644 --- a/compiler/rustc_trait_selection/src/traits/util.rs +++ b/compiler/rustc_trait_selection/src/traits/util.rs @@ -1,6 +1,5 @@ use rustc_errors::Diagnostic; use rustc_span::Span; -use smallvec::smallvec; use smallvec::SmallVec; use rustc_data_structures::fx::FxHashSet; From ade755d25112f8caf9029f9606bc945205644aff Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Mon, 26 Dec 2022 13:09:23 +0100 Subject: [PATCH 2/3] Fix missing renaming for #titles into #search-tabs --- src/librustdoc/html/static/css/themes/ayu.css | 8 ++++---- src/librustdoc/html/static/css/themes/dark.css | 4 ++-- src/librustdoc/html/static/css/themes/light.css | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/librustdoc/html/static/css/themes/ayu.css b/src/librustdoc/html/static/css/themes/ayu.css index 4ffc25e2688e4..36f1f955f5f89 100644 --- a/src/librustdoc/html/static/css/themes/ayu.css +++ b/src/librustdoc/html/static/css/themes/ayu.css @@ -162,18 +162,18 @@ pre, .rustdoc.source .example-wrap { color: #788797; } -#titles > button.selected { +#search-tabs > button.selected { background-color: #141920 !important; border-bottom: 1px solid #ffb44c !important; border-top: none; } -#titles > button:not(.selected) { +#search-tabs > button:not(.selected) { background-color: transparent !important; border: none; } -#titles > button:hover { +#search-tabs > button:hover { border-bottom: 1px solid rgba(242, 151, 24, 0.3); } @@ -185,7 +185,7 @@ above the `@media (max-width: 700px)` rules due to a bug in the css checker */ /* see https://github.com/rust-lang/rust/pull/71237#issuecomment-618170143 */ pre.rust .lifetime {} pre.rust .kw {} -#titles > button:hover, #titles > button.selected {} +#search-tabs > button:hover, #search-tabs > button.selected {} pre.rust .self, pre.rust .bool-val, pre.rust .prelude-val, pre.rust .attribute {} pre.rust .kw-2, pre.rust .prelude-ty {} diff --git a/src/librustdoc/html/static/css/themes/dark.css b/src/librustdoc/html/static/css/themes/dark.css index a7922cdeba100..6dd15d2e1bbaa 100644 --- a/src/librustdoc/html/static/css/themes/dark.css +++ b/src/librustdoc/html/static/css/themes/dark.css @@ -88,12 +88,12 @@ --scrape-example-toggle-line-hover-background: #c5c5c5; } -#titles > button:not(.selected) { +#search-tabs > button:not(.selected) { background-color: #252525; border-top-color: #252525; } -#titles > button:hover, #titles > button.selected { +#search-tabs > button:hover, #search-tabs > button.selected { border-top-color: #0089ff; background-color: #353535; } diff --git a/src/librustdoc/html/static/css/themes/light.css b/src/librustdoc/html/static/css/themes/light.css index aff46f8dc6dff..804e20d0d44e9 100644 --- a/src/librustdoc/html/static/css/themes/light.css +++ b/src/librustdoc/html/static/css/themes/light.css @@ -85,12 +85,12 @@ --scrape-example-toggle-line-hover-background: #999; } -#titles > button:not(.selected) { +#search-tabs > button:not(.selected) { background-color: #e6e6e6; border-top-color: #e6e6e6; } -#titles > button:hover, #titles > button.selected { +#search-tabs > button:hover, #search-tabs > button.selected { background-color: #ffffff; border-top-color: #0089ff; } From caa201fb9602aa8df874a1f95c40f47d742d8a8a Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Mon, 26 Dec 2022 13:09:40 +0100 Subject: [PATCH 3/3] Add GUI test for search tab headers --- src/test/rustdoc-gui/search-tab.goml | 76 ++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 src/test/rustdoc-gui/search-tab.goml diff --git a/src/test/rustdoc-gui/search-tab.goml b/src/test/rustdoc-gui/search-tab.goml new file mode 100644 index 0000000000000..c2634a04c8a74 --- /dev/null +++ b/src/test/rustdoc-gui/search-tab.goml @@ -0,0 +1,76 @@ +// Checking the colors of the search tab headers. +goto: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html?search=something" +show-text: true + +define-function: ( + "check-colors", + (theme, background, background_selected, background_hover, border_bottom, + border_bottom_selected, border_bottom_hover, border_top, border_top_selected, + border_top_hover), + [ + // Setting the theme. + ("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}), + ("reload"), + + // These two commands are used to be sure the search will be run. + ("focus", ".search-input"), + ("press-key", "Enter"), + + ("wait-for", "#search-tabs"), + ("assert-css", ("#search-tabs > button:not(.selected)", { + "background-color": |background|, + "border-bottom": |border_bottom|, + "border-top": |border_top|, + })), + ("assert-css", ("#search-tabs > button.selected", { + "background-color": |background_selected|, + "border-bottom": |border_bottom_selected|, + "border-top": |border_top_selected|, + })), + ("move-cursor-to", "#search-tabs > button:not(.selected)"), + ("assert-css", ("#search-tabs > button:not(.selected):hover", { + "background-color": |background_hover|, + "border-bottom": |border_bottom_hover|, + "border-top": |border_top_hover|, + })), + // To prevent disrupting next run of this function. + ("move-cursor-to", ".search-input"), + ], +) + +call-function: ("check-colors", { + "theme": "ayu", + "background": "rgba(0, 0, 0, 0)", + "background_selected": "rgb(20, 25, 32)", + "background_hover": "rgba(0, 0, 0, 0)", + "border_bottom": "0px none rgb(197, 197, 197)", + "border_bottom_selected": "1px solid rgb(255, 180, 76)", + "border_bottom_hover": "1px solid rgba(242, 151, 24, 0.3)", + "border_top": "0px none rgb(197, 197, 197)", + "border_top_selected": "0px none rgb(197, 197, 197)", + "border_top_hover": "0px none rgb(197, 197, 197)", +}) +call-function: ("check-colors", { + "theme": "dark", + "background": "rgb(37, 37, 37)", + "background_selected": "rgb(53, 53, 53)", + "background_hover": "rgb(53, 53, 53)", + "border_bottom": "0px none rgb(221, 221, 221)", + "border_bottom_selected": "0px none rgb(221, 221, 221)", + "border_bottom_hover": "0px none rgb(221, 221, 221)", + "border_top": "2px solid rgb(37, 37, 37)", + "border_top_selected": "2px solid rgb(0, 137, 255)", + "border_top_hover": "2px solid rgb(0, 137, 255)", +}) +call-function: ("check-colors", { + "theme": "light", + "background": "rgb(230, 230, 230)", + "background_selected": "rgb(255, 255, 255)", + "background_hover": "rgb(255, 255, 255)", + "border_bottom": "0px none rgb(0, 0, 0)", + "border_bottom_selected": "0px none rgb(0, 0, 0)", + "border_bottom_hover": "0px none rgb(0, 0, 0)", + "border_top": "2px solid rgb(230, 230, 230)", + "border_top_selected": "2px solid rgb(0, 137, 255)", + "border_top_hover": "2px solid rgb(0, 137, 255)", +})