Commit graph

19 commits

Author SHA1 Message Date
Philipp Hansch
67167be167
Make empty_line_after_outer_attr an early lint 2020-05-26 16:52:02 +02:00
Michael Wright
11682b4cd2 Add rustfmt::skip to outer attr format tests 2019-02-27 07:41:07 +02:00
A.A.Abroskin
c771f339d7 allow assertions_on_constants for collapsible_if and missing_test_files 2019-01-23 17:58:33 +03:00
A.A.Abroskin
f11d993c0f Merge branch 'master' into add-lints-aseert-checks
* master: (58 commits)
  Rustfmt all the things
  Don't make decisions on values that don't represent the decision
  Improving comments.
  Rustup
  Added rustfix to the test.
  Improve span shortening.
  Added "make_return" and "blockify" convenience methods in Sugg and used them in "needless_bool".
  Actually check for constants.
  Fixed potential mistakes with nesting. Added tests.
  formatting fix
  Update clippy_lints/src/needless_bool.rs
  formatting fix
  Fixing typo in CONTRIBUTING.md
  Fix breakage due to rust-lang/rust#57651
  needless bool lint suggestion is wrapped in brackets if it is an "else" clause of an "if-else" statement
  Fix automatic suggestion on `use_self`.
  Remove negative integer literal checks.
  Fix `implicit_return` false positives.
  Run rustfmt
  Fixed breakage due to rust-lang/rust#57489
  ...
2019-01-23 11:36:12 +03:00
A.A.Abroskin
906b51637c change assert_checks to assertions_on_constants 2019-01-09 13:38:38 +03:00
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
A.A.Abroskin
98c5f37ad2 Add assert(true) and assert(false) lints 2019-01-07 13:30:17 +03: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