@@ -4,7 +4,6 @@ mod blanket_clippy_restriction_lints;
44mod deprecated_cfg_attr;
55mod deprecated_semver;
66mod duplicated_attributes;
7- mod empty_line_after;
87mod inline_always;
98mod mixed_attributes_style;
109mod non_minimal_cfg;
@@ -126,94 +125,6 @@ declare_clippy_lint! {
126125 "use of `#[deprecated(since = \" x\" )]` where x is not semver"
127126}
128127
129- declare_clippy_lint ! {
130- /// ### What it does
131- /// Checks for empty lines after outer attributes
132- ///
133- /// ### Why is this bad?
134- /// Most likely the attribute was meant to be an inner attribute using a '!'.
135- /// If it was meant to be an outer attribute, then the following item
136- /// should not be separated by empty lines.
137- ///
138- /// ### Known problems
139- /// Can cause false positives.
140- ///
141- /// From the clippy side it's difficult to detect empty lines between an attributes and the
142- /// following item because empty lines and comments are not part of the AST. The parsing
143- /// currently works for basic cases but is not perfect.
144- ///
145- /// ### Example
146- /// ```no_run
147- /// #[allow(dead_code)]
148- ///
149- /// fn not_quite_good_code() { }
150- /// ```
151- ///
152- /// Use instead:
153- /// ```no_run
154- /// // Good (as inner attribute)
155- /// #![allow(dead_code)]
156- ///
157- /// fn this_is_fine() { }
158- ///
159- /// // or
160- ///
161- /// // Good (as outer attribute)
162- /// #[allow(dead_code)]
163- /// fn this_is_fine_too() { }
164- /// ```
165- #[ clippy:: version = "pre 1.29.0" ]
166- pub EMPTY_LINE_AFTER_OUTER_ATTR ,
167- nursery,
168- "empty line after outer attribute"
169- }
170-
171- declare_clippy_lint ! {
172- /// ### What it does
173- /// Checks for empty lines after documentation comments.
174- ///
175- /// ### Why is this bad?
176- /// The documentation comment was most likely meant to be an inner attribute or regular comment.
177- /// If it was intended to be a documentation comment, then the empty line should be removed to
178- /// be more idiomatic.
179- ///
180- /// ### Known problems
181- /// Only detects empty lines immediately following the documentation. If the doc comment is followed
182- /// by an attribute and then an empty line, this lint will not trigger. Use `empty_line_after_outer_attr`
183- /// in combination with this lint to detect both cases.
184- ///
185- /// Does not detect empty lines after doc attributes (e.g. `#[doc = ""]`).
186- ///
187- /// ### Example
188- /// ```no_run
189- /// /// Some doc comment with a blank line after it.
190- ///
191- /// fn not_quite_good_code() { }
192- /// ```
193- ///
194- /// Use instead:
195- /// ```no_run
196- /// /// Good (no blank line)
197- /// fn this_is_fine() { }
198- /// ```
199- ///
200- /// ```no_run
201- /// // Good (convert to a regular comment)
202- ///
203- /// fn this_is_fine_too() { }
204- /// ```
205- ///
206- /// ```no_run
207- /// //! Good (convert to a comment on an inner attribute)
208- ///
209- /// fn this_is_fine_as_well() { }
210- /// ```
211- #[ clippy:: version = "1.70.0" ]
212- pub EMPTY_LINE_AFTER_DOC_COMMENTS ,
213- nursery,
214- "empty line after documentation comments"
215- }
216-
217128declare_clippy_lint ! {
218129 /// ### What it does
219130 /// Checks for `warn`/`deny`/`forbid` attributes targeting the whole clippy::restriction category.
@@ -601,18 +512,12 @@ impl EarlyAttributes {
601512
602513impl_lint_pass ! ( EarlyAttributes => [
603514 DEPRECATED_CFG_ATTR ,
604- EMPTY_LINE_AFTER_OUTER_ATTR ,
605- EMPTY_LINE_AFTER_DOC_COMMENTS ,
606515 NON_MINIMAL_CFG ,
607516 DEPRECATED_CLIPPY_CFG_ATTR ,
608517 UNNECESSARY_CLIPPY_CFG ,
609518] ) ;
610519
611520impl EarlyLintPass for EarlyAttributes {
612- fn check_item ( & mut self , cx : & EarlyContext < ' _ > , item : & rustc_ast:: Item ) {
613- empty_line_after:: check ( cx, item) ;
614- }
615-
616521 fn check_attribute ( & mut self , cx : & EarlyContext < ' _ > , attr : & Attribute ) {
617522 deprecated_cfg_attr:: check ( cx, attr, & self . msrv ) ;
618523 deprecated_cfg_attr:: check_clippy ( cx, attr) ;
0 commit comments