From 0f8ba1cb80438806062a829b3dbcbdc47db7cde2 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Tue, 5 Nov 2024 21:47:29 +0100 Subject: [PATCH] Update UI tests --- tests/ui/empty_line_after/doc_comments.stderr | 20 ++++++------- .../empty_line_after/outer_attribute.stderr | 28 +++++++++++-------- tests/ui/suspicious_doc_comments.fixed | 1 + tests/ui/suspicious_doc_comments.rs | 1 + tests/ui/suspicious_doc_comments.stderr | 18 ++++++------ 5 files changed, 38 insertions(+), 30 deletions(-) diff --git a/tests/ui/empty_line_after/doc_comments.stderr b/tests/ui/empty_line_after/doc_comments.stderr index c238b4c9a17f..568e72078283 100644 --- a/tests/ui/empty_line_after/doc_comments.stderr +++ b/tests/ui/empty_line_after/doc_comments.stderr @@ -5,7 +5,7 @@ LL | / /// for the crate LL | | | |_ LL | fn first_in_crate() {} - | ------------------- the comment documents this function + | ---------------------- the comment documents this function | = note: `-D clippy::empty-line-after-doc-comments` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::empty_line_after_doc_comments)]` @@ -24,7 +24,7 @@ LL | / /// for the module LL | | | |_ LL | fn first_in_module() {} - | -------------------- the comment documents this function + | ----------------------- the comment documents this function | = help: if the empty line is unintentional remove it help: if the comment should document the parent module use an inner doc comment @@ -42,7 +42,7 @@ LL | | | |_ LL | /// Blank line LL | fn indented() {} - | ------------- the comment documents this function + | ---------------- the comment documents this function | = help: if the empty line is unintentional remove it help: if the documentation should include the empty line include it in the comment @@ -57,7 +57,7 @@ LL | / /// This should produce a warning LL | | | |_ LL | fn with_doc_and_newline() {} - | ------------------------- the comment documents this function + | ---------------------------- the comment documents this function | = help: if the empty line is unintentional remove it @@ -72,7 +72,7 @@ LL | | | |_ ... LL | fn three_attributes() {} - | --------------------- the comment documents this function + | ------------------------ the comment documents this function | = help: if the empty lines are unintentional remove them @@ -84,7 +84,7 @@ LL | | // fn old_code() {} LL | | | |_ LL | fn new_code() {} - | ------------- the comment documents this function + | ---------------- the comment documents this function | = help: if the empty line is unintentional remove it help: if the doc comment should not document `new_code` comment it out @@ -105,7 +105,7 @@ LL | | | |_ ... LL | struct Multiple; - | --------------- the comment documents this struct + | ---------------- the comment documents this struct | = help: if the empty lines are unintentional remove them help: if the doc comment should not document `Multiple` comment it out @@ -127,7 +127,7 @@ LL | | */ LL | | | |_ LL | fn first_in_module() {} - | -------------------- the comment documents this function + | ----------------------- the comment documents this function | = help: if the empty line is unintentional remove it help: if the comment should document the parent module use an inner doc comment @@ -146,7 +146,7 @@ LL | | | |_ ... LL | fn new_code() {} - | ------------- the comment documents this function + | ---------------- the comment documents this function | = help: if the empty line is unintentional remove it help: if the doc comment should not document `new_code` comment it out @@ -164,7 +164,7 @@ LL | | | |_ LL | /// Docs for `new_code2` LL | fn new_code2() {} - | -------------- the comment documents this function + | ----------------- the comment documents this function | = help: if the empty line is unintentional remove it help: if the doc comment should not document `new_code2` comment it out diff --git a/tests/ui/empty_line_after/outer_attribute.stderr b/tests/ui/empty_line_after/outer_attribute.stderr index 958b40424a92..a6d9690bce8e 100644 --- a/tests/ui/empty_line_after/outer_attribute.stderr +++ b/tests/ui/empty_line_after/outer_attribute.stderr @@ -5,7 +5,7 @@ LL | / #[crate_type = "lib"] LL | | | |_ LL | fn first_in_crate() {} - | ------------------- the attribute applies to this function + | ---------------------- the attribute applies to this function | = note: `-D clippy::empty-line-after-outer-attr` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::empty_line_after_outer_attr)]` @@ -23,7 +23,7 @@ LL | | | |_ LL | /// some comment LL | fn with_one_newline_and_comment() {} - | --------------------------------- the attribute applies to this function + | ------------------------------------ the attribute applies to this function | = help: if the empty line is unintentional remove it @@ -34,7 +34,7 @@ LL | / #[inline] LL | | | |_ LL | fn with_one_newline() {} - | --------------------- the attribute applies to this function + | ------------------------ the attribute applies to this function | = help: if the empty line is unintentional remove it @@ -46,7 +46,7 @@ LL | | LL | | | |_ LL | fn with_two_newlines() {} - | ---------------------- the attribute applies to this function + | ------------------------- the attribute applies to this function | = help: if the empty lines are unintentional remove them help: if the attribute should apply to the parent module use an inner attribute @@ -60,8 +60,11 @@ error: empty line after outer attribute LL | / #[doc = "doc attributes should be considered attributes"] LL | | | |_ -LL | enum Baz { - | -------- the attribute applies to this enum +LL | / enum Baz { +LL | | One, +LL | | Two, +LL | | } + | |_- the attribute applies to this enum | = help: if the empty line is unintentional remove it @@ -71,8 +74,11 @@ error: empty line after outer attribute LL | / #[repr(C)] LL | | | |_ -LL | struct Foo { - | ---------- the attribute applies to this struct +LL | / struct Foo { +LL | | one: isize, +LL | | two: isize, +LL | | } + | |_- the attribute applies to this struct | = help: if the empty line is unintentional remove it @@ -83,7 +89,7 @@ LL | / #[allow(dead_code)] LL | | | |_ LL | mod foo {} - | ------- the attribute applies to this module + | ---------- the attribute applies to this module | = help: if the empty line is unintentional remove it @@ -95,7 +101,7 @@ LL | | // Still lint cases where the empty line does not immediately follow the LL | | | |_ LL | fn comment_before_empty_line() {} - | ------------------------------ the attribute applies to this function + | --------------------------------- the attribute applies to this function | = help: if the empty line is unintentional remove it @@ -108,7 +114,7 @@ LL | | // This comment is isolated LL | | | |_ LL | pub fn isolated_comment() {} - | ------------------------- the attribute applies to this function + | ---------------------------- the attribute applies to this function | = help: if the empty lines are unintentional remove them diff --git a/tests/ui/suspicious_doc_comments.fixed b/tests/ui/suspicious_doc_comments.fixed index 614fc03571e5..d3df6a41cb12 100644 --- a/tests/ui/suspicious_doc_comments.fixed +++ b/tests/ui/suspicious_doc_comments.fixed @@ -1,5 +1,6 @@ #![allow(unused)] #![warn(clippy::suspicious_doc_comments)] +#![allow(clippy::empty_line_after_doc_comments)] //! Real module documentation. //! Fake module documentation. diff --git a/tests/ui/suspicious_doc_comments.rs b/tests/ui/suspicious_doc_comments.rs index 7dcba0fefc98..04db2b199c09 100644 --- a/tests/ui/suspicious_doc_comments.rs +++ b/tests/ui/suspicious_doc_comments.rs @@ -1,5 +1,6 @@ #![allow(unused)] #![warn(clippy::suspicious_doc_comments)] +#![allow(clippy::empty_line_after_doc_comments)] //! Real module documentation. ///! Fake module documentation. diff --git a/tests/ui/suspicious_doc_comments.stderr b/tests/ui/suspicious_doc_comments.stderr index f12053b1595a..c34e39cd0fcb 100644 --- a/tests/ui/suspicious_doc_comments.stderr +++ b/tests/ui/suspicious_doc_comments.stderr @@ -1,5 +1,5 @@ error: this is an outer doc comment and does not apply to the parent module or crate - --> tests/ui/suspicious_doc_comments.rs:5:1 + --> tests/ui/suspicious_doc_comments.rs:6:1 | LL | ///! Fake module documentation. | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -12,7 +12,7 @@ LL | //! Fake module documentation. | error: this is an outer doc comment and does not apply to the parent module or crate - --> tests/ui/suspicious_doc_comments.rs:9:5 + --> tests/ui/suspicious_doc_comments.rs:10:5 | LL | ///! This module contains useful functions. | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -23,7 +23,7 @@ LL | //! This module contains useful functions. | error: this is an outer doc comment and does not apply to the parent module or crate - --> tests/ui/suspicious_doc_comments.rs:21:5 + --> tests/ui/suspicious_doc_comments.rs:22:5 | LL | / /**! This module contains useful functions. LL | | */ @@ -36,7 +36,7 @@ LL + */ | error: this is an outer doc comment and does not apply to the parent module or crate - --> tests/ui/suspicious_doc_comments.rs:35:5 + --> tests/ui/suspicious_doc_comments.rs:36:5 | LL | / ///! This module LL | | ///! contains @@ -51,7 +51,7 @@ LL ~ //! useful functions. | error: this is an outer doc comment and does not apply to the parent module or crate - --> tests/ui/suspicious_doc_comments.rs:43:5 + --> tests/ui/suspicious_doc_comments.rs:44:5 | LL | / ///! a LL | | ///! b @@ -64,7 +64,7 @@ LL ~ //! b | error: this is an outer doc comment and does not apply to the parent module or crate - --> tests/ui/suspicious_doc_comments.rs:51:5 + --> tests/ui/suspicious_doc_comments.rs:52:5 | LL | ///! a | ^^^^^^ @@ -75,7 +75,7 @@ LL | //! a | error: this is an outer doc comment and does not apply to the parent module or crate - --> tests/ui/suspicious_doc_comments.rs:57:5 + --> tests/ui/suspicious_doc_comments.rs:58:5 | LL | / ///! a LL | | @@ -90,7 +90,7 @@ LL ~ //! b | error: this is an outer doc comment and does not apply to the parent module or crate - --> tests/ui/suspicious_doc_comments.rs:69:5 + --> tests/ui/suspicious_doc_comments.rs:70:5 | LL | ///! Very cool macro | ^^^^^^^^^^^^^^^^^^^^ @@ -101,7 +101,7 @@ LL | //! Very cool macro | error: this is an outer doc comment and does not apply to the parent module or crate - --> tests/ui/suspicious_doc_comments.rs:76:5 + --> tests/ui/suspicious_doc_comments.rs:77:5 | LL | ///! Huh. | ^^^^^^^^^