Commit graph

13 commits

Author SHA1 Message Date
Philipp Hansch
38d4ac7cea
Remove all copyright license headers
Discussion previously happened in https://github.com/rust-lang/rust/pull/43498
2019-01-08 21:46:39 +01:00
Matthias Krüger
4583d78156 add rustfmt::skip attributes to some tests 2018-12-09 17:21:49 +01:00
Oliver Scherer
b8654eaa6c Stabilize tool lints 2018-10-11 12:16:22 +02:00
Manish Goregaokar
e9c025ea70 Add license header to Rust files 2018-10-06 09:43:08 -07:00
flip1995
1b6f6051a8 Adapt ui-tests to the tool_lints 2018-08-29 11:08:29 -07:00
Philipp Hansch
db1ec44616
Handle nested block comments 2018-03-30 12:36:50 +02:00
Philipp Hansch
b7929cafe1
Fix false positive in empty_line_after_outer_attr
Before, when you had a block comment between an attribute and the
following item like this:

```rust
\#[crate_type = "lib"]
/*

*/
pub struct Rust;
```

It would cause a false positive on the lint, because there is an empty
line inside the block comment.

This makes sure that basic block comments are detected and removed from
the snippet that was created before.
2018-03-30 12:36:50 +02:00
Philipp Hansch
034c81b761
Fix false positive in empty_line_after_outer_attribute
`empty_line_after_outer_attribute` produced a false positive warning when
deriving `Copy` and/or `Clone` for an item.

It looks like the second point in [this comment][that_comment] is related,
as the attribute that causes the false positive has a path of
`rustc_copy_clone_marker`.

Fixes #2475

[that_comment]: https://github.com/rust-lang/rust/issues/35900#issuecomment-245978831
2018-03-26 21:57:42 +02:00
Philipp Hansch
d3d3d7d7be
Lint multiline attributes properly
This makes it so that the `empty_line_after_outer_attribute` lint only
checks for newlines between the end of the attribute and the beginning
of the following item.

We need to check for the empty line count being bigger than 2 because
now the snippet of valid code contains only `\n` and splitting it
produces `["", ""]`
Invalid code will contain more than 2 empty strings.
2018-02-21 21:29:05 +01:00
Philipp Hansch
a64724fac4
Fix false positive in empty_line_after_outer_attr
Doc comments are syntactic sugar for #[doc] attributes, so this lint was
catching them, too.

This commit makes it so that doc comments are ignored in this lint.

I think, for normal attributes it makes sense to warn about following empty
lines, for doc comments, less. This way the user has some freedom over
the formatting.
2018-02-01 07:43:03 +01:00
Philipp Hansch
aade0d563e
Make lint work on all members of ast::Item_ 2018-01-29 10:03:52 +01:00
Philipp Hansch
83909398d2
Add test case for comments between item and attr 2018-01-29 10:03:52 +01:00
Philipp Hansch
80827c1f74
Warn on empty lines after outer attributes 2018-01-29 10:03:52 +01:00