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.
Fix span so it no longer contains the whole train-wreck of code and only
points to the problem function (for the unwrap_or lint).
https://github.com/rust-lang-nursery/rust-clippy/issues/2422
Update ui test methods - it had several cases where the error message
span is now shorter
This fixes an incorrect suggestion from the `useless_attribute` lint
when using `cfg_attr`.
Additionally, it will not show a suggestion anymore, if the attribute
begins on a previous line, because it is much harder to construct the
span of multi-line `cfg_attr` attributes as they don't appear in the AST.
To fix it completely, one would have to parse upwards into the file,
and find the beginning of the `cfg_attr` attribute.
This makes sure that empty lines in lint examples are preserved.
It also fixes the documentation for the invalid_ref lint, which was not
shown because of an extra newline before the lint declaration.
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.
If the snippet is empty, it's an attribute that was inserted during macro
expansion and we want to ignore those, because they could come from external
sources that the user has no control over.
For some reason these attributes don't have any expansion info on them, so
we have to check it this way until there is a better way.