From 835a102dd32f6c95951f5d1f19bc121a8fa6fb7d Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Sat, 1 Oct 2022 10:40:16 -0700 Subject: [PATCH 1/4] rustdoc: remove no-op CSS `.impl { flex-basis: 100% }` etc When `.impl-items { flex-basis: 100% }` and `h3.impl, h3.method, h4.method, h3.type, h4.type, h4.associatedconstant` were added in 34bd2b845b3acd84c5a9bddae3ff8081c19ec5e9, it seems like it was a mistake even then. According to MDN, [flex-basis] does nothing unless the box it's applied to is a flex *item*, a child of a flex container. However, when this was added, these elements were flex containers themselves. [flex-basis]: https://developer.mozilla.org/en-US/docs/Web/CSS/flex-basis --- src/librustdoc/html/static/css/rustdoc.css | 1 - 1 file changed, 1 deletion(-) diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index 84e6df59f576b..d8364ec472077 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -193,7 +193,6 @@ h4.code-header { .methods .associatedconstant, .impl-items .associatedtype, .methods .associatedtype { - flex-basis: 100%; position: relative; } From d46e558a93a281a9e41a35cb181a375df388f60c Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Sat, 1 Oct 2022 10:42:13 -0700 Subject: [PATCH 2/4] rustdoc: remove no-op CSS `.impl { position: relative }` etc This property was added to help with positioning the `[+]/[-]` toggle. It is no longer necessary, because `details.rustdoc-toggle` already has `position:relative` set on it. --- src/librustdoc/html/static/css/rustdoc.css | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index d8364ec472077..f67d580e28e82 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -184,17 +184,6 @@ h4.code-header { margin: 0; padding: 0; } -.impl, -.impl-items .method, -.methods .method, -.impl-items .type, -.methods .type, -.impl-items .associatedconstant, -.methods .associatedconstant, -.impl-items .associatedtype, -.methods .associatedtype { - position: relative; -} #crate-search, h1, h2, h3, h4, h5, h6, From 8cc81407757e68e309924c03ed1815a01469d026 Mon Sep 17 00:00:00 2001 From: Maybe Waffle Date: Sun, 2 Oct 2022 15:40:20 +0000 Subject: [PATCH 3/4] Remove a couple lifetimes that could be infered --- compiler/rustc_middle/src/lint.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/compiler/rustc_middle/src/lint.rs b/compiler/rustc_middle/src/lint.rs index f3e4f1faeb05c..7b0054a96d3ea 100644 --- a/compiler/rustc_middle/src/lint.rs +++ b/compiler/rustc_middle/src/lint.rs @@ -274,29 +274,28 @@ pub fn explain_lint_level_source( } } -pub fn struct_lint_level<'s, 'd>( - sess: &'s Session, +pub fn struct_lint_level( + sess: &Session, lint: &'static Lint, level: Level, src: LintLevelSource, span: Option, msg: impl Into, - decorate: impl 'd - + for<'a, 'b> FnOnce( + decorate: impl for<'a, 'b> FnOnce( &'b mut DiagnosticBuilder<'a, ()>, ) -> &'b mut DiagnosticBuilder<'a, ()>, ) { // Avoid codegen bloat from monomorphization by immediately doing dyn dispatch of `decorate` to // the "real" work. - fn struct_lint_level_impl<'s, 'd>( - sess: &'s Session, + fn struct_lint_level_impl( + sess: &Session, lint: &'static Lint, level: Level, src: LintLevelSource, span: Option, msg: impl Into, decorate: Box< - dyn 'd + dyn '_ + for<'a, 'b> FnOnce( &'b mut DiagnosticBuilder<'a, ()>, ) -> &'b mut DiagnosticBuilder<'a, ()>, From afae9576dcff73e0b674286be3636d9a101a60f7 Mon Sep 17 00:00:00 2001 From: Petr Portnov Date: Sun, 2 Oct 2022 21:40:39 +0300 Subject: [PATCH 4/4] Fix duplicate usage of `a` article. This fixes a typo first appearing in #94624 in which test-macro diagnostic uses "a" article twice. Since I searched sources for " a a " sequences, I also fixed the same issue in a few source files where I found it. Signed-off-by: Petr Portnov --- compiler/rustc_builtin_macros/src/test.rs | 2 +- src/test/ui/test-attrs/test-on-not-fn.stderr | 24 +++++++++---------- .../ide-db/src/imports/merge_imports.rs | 2 +- .../crates/rust-analyzer/src/bin/logger.rs | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/compiler/rustc_builtin_macros/src/test.rs b/compiler/rustc_builtin_macros/src/test.rs index 7efb6cc61eecb..705141614e252 100644 --- a/compiler/rustc_builtin_macros/src/test.rs +++ b/compiler/rustc_builtin_macros/src/test.rs @@ -115,7 +115,7 @@ pub fn expand_test_or_bench( // reworked in the future to not need it, it'd be nice. _ => diag.struct_span_err(attr_sp, msg).forget_guarantee(), }; - err.span_label(attr_sp, "the `#[test]` macro causes a a function to be run on a test and has no effect on non-functions") + err.span_label(attr_sp, "the `#[test]` macro causes a function to be run on a test and has no effect on non-functions") .span_label(item.span, format!("expected a non-associated function, found {} {}", item.kind.article(), item.kind.descr())) .span_suggestion(attr_sp, "replace with conditional compilation to make the item only exist when tests are being run", "#[cfg(test)]", Applicability::MaybeIncorrect) .emit(); diff --git a/src/test/ui/test-attrs/test-on-not-fn.stderr b/src/test/ui/test-attrs/test-on-not-fn.stderr index 23efd5bc0d9fa..fc2c5f62bedb0 100644 --- a/src/test/ui/test-attrs/test-on-not-fn.stderr +++ b/src/test/ui/test-attrs/test-on-not-fn.stderr @@ -2,7 +2,7 @@ error: the `#[test]` attribute may only be used on a non-associated function --> $DIR/test-on-not-fn.rs:3:1 | LL | #[test] - | ^^^^^^^ the `#[test]` macro causes a a function to be run on a test and has no effect on non-functions + | ^^^^^^^ the `#[test]` macro causes a function to be run on a test and has no effect on non-functions LL | mod test {} | ----------- expected a non-associated function, found a module | @@ -15,7 +15,7 @@ error: the `#[test]` attribute may only be used on a non-associated function --> $DIR/test-on-not-fn.rs:6:1 | LL | #[test] - | ^^^^^^^ the `#[test]` macro causes a a function to be run on a test and has no effect on non-functions + | ^^^^^^^ the `#[test]` macro causes a function to be run on a test and has no effect on non-functions LL | / mod loooooooooooooong_teeeeeeeeeest { LL | | /* LL | | this is a comment @@ -34,7 +34,7 @@ error: the `#[test]` attribute may only be used on a non-associated function --> $DIR/test-on-not-fn.rs:20:1 | LL | #[test] - | ^^^^^^^ the `#[test]` macro causes a a function to be run on a test and has no effect on non-functions + | ^^^^^^^ the `#[test]` macro causes a function to be run on a test and has no effect on non-functions LL | extern "C" {} | ------------- expected a non-associated function, found an extern block | @@ -47,7 +47,7 @@ error: the `#[test]` attribute may only be used on a non-associated function --> $DIR/test-on-not-fn.rs:23:1 | LL | #[test] - | ^^^^^^^ the `#[test]` macro causes a a function to be run on a test and has no effect on non-functions + | ^^^^^^^ the `#[test]` macro causes a function to be run on a test and has no effect on non-functions LL | trait Foo {} | ------------ expected a non-associated function, found a trait | @@ -60,7 +60,7 @@ error: the `#[test]` attribute may only be used on a non-associated function --> $DIR/test-on-not-fn.rs:26:1 | LL | #[test] - | ^^^^^^^ the `#[test]` macro causes a a function to be run on a test and has no effect on non-functions + | ^^^^^^^ the `#[test]` macro causes a function to be run on a test and has no effect on non-functions LL | impl Foo for i32 {} | ------------------- expected a non-associated function, found an implementation | @@ -73,7 +73,7 @@ error: the `#[test]` attribute may only be used on a non-associated function --> $DIR/test-on-not-fn.rs:29:1 | LL | #[test] - | ^^^^^^^ the `#[test]` macro causes a a function to be run on a test and has no effect on non-functions + | ^^^^^^^ the `#[test]` macro causes a function to be run on a test and has no effect on non-functions LL | const FOO: i32 = -1_i32; | ------------------------ expected a non-associated function, found a constant item | @@ -86,7 +86,7 @@ error: the `#[test]` attribute may only be used on a non-associated function --> $DIR/test-on-not-fn.rs:32:1 | LL | #[test] - | ^^^^^^^ the `#[test]` macro causes a a function to be run on a test and has no effect on non-functions + | ^^^^^^^ the `#[test]` macro causes a function to be run on a test and has no effect on non-functions LL | static BAR: u64 = 10_000_u64; | ----------------------------- expected a non-associated function, found a static item | @@ -99,7 +99,7 @@ error: the `#[test]` attribute may only be used on a non-associated function --> $DIR/test-on-not-fn.rs:35:1 | LL | #[test] - | ^^^^^^^ the `#[test]` macro causes a a function to be run on a test and has no effect on non-functions + | ^^^^^^^ the `#[test]` macro causes a function to be run on a test and has no effect on non-functions LL | / enum MyUnit { LL | | Unit, LL | | } @@ -114,7 +114,7 @@ error: the `#[test]` attribute may only be used on a non-associated function --> $DIR/test-on-not-fn.rs:40:1 | LL | #[test] - | ^^^^^^^ the `#[test]` macro causes a a function to be run on a test and has no effect on non-functions + | ^^^^^^^ the `#[test]` macro causes a function to be run on a test and has no effect on non-functions LL | struct NewI32(i32); | ------------------- expected a non-associated function, found a struct | @@ -127,7 +127,7 @@ error: the `#[test]` attribute may only be used on a non-associated function --> $DIR/test-on-not-fn.rs:43:1 | LL | #[test] - | ^^^^^^^ the `#[test]` macro causes a a function to be run on a test and has no effect on non-functions + | ^^^^^^^ the `#[test]` macro causes a function to be run on a test and has no effect on non-functions LL | / union Spooky { LL | | x: i32, LL | | y: u32, @@ -143,7 +143,7 @@ error: the `#[test]` attribute may only be used on a non-associated function --> $DIR/test-on-not-fn.rs:50:1 | LL | #[test] - | ^^^^^^^ the `#[test]` macro causes a a function to be run on a test and has no effect on non-functions + | ^^^^^^^ the `#[test]` macro causes a function to be run on a test and has no effect on non-functions LL | #[derive(Copy, Clone, Debug)] LL | / struct MoreAttrs { LL | | a: i32, @@ -160,7 +160,7 @@ warning: the `#[test]` attribute may only be used on a non-associated function --> $DIR/test-on-not-fn.rs:61:1 | LL | #[test] - | ^^^^^^^ the `#[test]` macro causes a a function to be run on a test and has no effect on non-functions + | ^^^^^^^ the `#[test]` macro causes a function to be run on a test and has no effect on non-functions LL | foo!(); | ------- expected a non-associated function, found an item macro invocation | diff --git a/src/tools/rust-analyzer/crates/ide-db/src/imports/merge_imports.rs b/src/tools/rust-analyzer/crates/ide-db/src/imports/merge_imports.rs index 7fb4b90e6d992..371d642c15d1d 100644 --- a/src/tools/rust-analyzer/crates/ide-db/src/imports/merge_imports.rs +++ b/src/tools/rust-analyzer/crates/ide-db/src/imports/merge_imports.rs @@ -225,7 +225,7 @@ fn path_cmp_short(a: &ast::Path, b: &ast::Path) -> Ordering { } /// Compares two paths, if one ends earlier than the other the has_tl parameters decide which is -/// greater as a a path that has a tree list should be greater, while one that just ends without +/// greater as a path that has a tree list should be greater, while one that just ends without /// a tree list should be considered less. pub(super) fn use_tree_path_cmp( a: &ast::Path, diff --git a/src/tools/rust-analyzer/crates/rust-analyzer/src/bin/logger.rs b/src/tools/rust-analyzer/crates/rust-analyzer/src/bin/logger.rs index 298814af5a465..ac10721d95514 100644 --- a/src/tools/rust-analyzer/crates/rust-analyzer/src/bin/logger.rs +++ b/src/tools/rust-analyzer/crates/rust-analyzer/src/bin/logger.rs @@ -132,7 +132,7 @@ where let ext = span.extensions(); - // `FormattedFields` is a a formatted representation of the span's + // `FormattedFields` is a formatted representation of the span's // fields, which is stored in its extensions by the `fmt` layer's // `new_span` method. The fields will have been formatted // by the same field formatter that's provided to the event