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