bors [Mon, 14 Jan 2019 14:50:27 +0000 (14:50 +0000)]
Auto merge of #3657 - roblabla:bugfix-missing-docs-global-asm, r=phansch
Missing docs: don't require documenting Global Asm items.
global_asm! items cannot be documented, the lint still gets triggered after adding documentation to the macro invocation. Furthermore, even if we could add documentation to the AST node, rustdoc doesn't render it anyways.
bors [Mon, 14 Jan 2019 08:16:51 +0000 (08:16 +0000)]
Auto merge of #3658 - detrumi:add-several-run-rustfix-annotations, r=phansch
Add several run rustfix annotations
Adds `run-rustfix` to 18 of the tests from the tracking issue #3630.
Each test has its own commit, to make reviewing easier (hopefully this is easier to review than 18 separate PRs).
## Changes
- `cfg_attr_rustfmt`: Custom inner attributes are unstable. Let's disable the lint for inner attributes until [#54726](https://github.com/rust-lang/rust/issues/54726) stabilizes
- `collapsible_if`: unrelated cyclomatic_complexity warning that can be ignored
- `duration_subsec`: Simply needed `#![allow(dead_code)]`
- `excessive_precision`: Fixed by `#!allow(dead_code,unused_variables)`
- `explicit_write`: Fixed by `#![allow(unused_imports)]`
- `inconsistent_digit_grouping`: Avoid triggering `clippy::excessive_precision` lint
- `infallible_destructuring_match`: Fixed by `#![allow(dead_code, unreachable_code, unused_variables)]`
- `into_iter_on_ref`: Triggered unrelated `clippy::useless_vec` lint
- `large_digit_groups`: Avoid triggering `clippy::excessive_precision` lint
- `map_clone`: Fixed by `#![allow(clippy::iter_cloned_collect)]`
- `mem_replace`: Suggestion causes import to be unused, fixed by `#![allow(unused_imports)]`
- `precedence`: Allow some unrelated lints, and change out-of-range `0b1111_1111i8` literal
- `redundant_field_names`: Allow dead code, and remove stabilized feature toggles
- `replace_consts`: Fixed by `#![allow(unused_variables)]`
- `starts_ends_with`: Fixed by `#![allow(unused_must_use)]`
- `types`: Fixed by `#![allow(dead_code, unused_variables)]`
- `unit_arg`: Fixed by `#[allow(unused_must_use)]`
- `unnecessary_fold`: Fixed by adding type annotations and adding `#![allow(dead_code)]`
roblabla [Sun, 13 Jan 2019 16:09:58 +0000 (16:09 +0000)]
Missing docs: don't require documenting Global Asm items.
global_asm! items cannot be documented, the lint still gets triggered
after adding documentation to the macro invocation. Furthermore, even
if we could add documentation to the AST node, rustdoc doesn't render
it anyways.
bors [Wed, 9 Jan 2019 21:53:55 +0000 (21:53 +0000)]
Auto merge of #3645 - phansch:remove_copyright_headers, r=oli-obk
Remove all copyright license headers
Discussion previously happened in https://github.com/rust-lang/rust/pull/43498 and here: https://github.com/rust-lang/rust-clippy/pull/3642#issuecomment-452251727
bors [Mon, 7 Jan 2019 18:54:28 +0000 (18:54 +0000)]
Auto merge of #3640 - detrumi:nested_use_self, r=flip1995
Restrict `use_self` on nested items
Fixes #3637
Fixes #3463
These changes make it so that nested items aren't visited any more by the `use_self` lint.
I think visiting nested items should be possible (so that it uses a different `item_path` for the nested item), but I'm not sure whether it's viable and what the best approach would be.
- Can `item_path` be changed to a new `Self` path before visiting the item, and then changing it back afterwards?
- Alternatively, could a new visitor be created, re-using `check_trait_method_impl_decl`?
bors [Mon, 7 Jan 2019 18:30:53 +0000 (18:30 +0000)]
Auto merge of #3600 - xfix:cast-ref-to-mut, r=flip1995
cast_ref_to_mut lint
I see this pattern way too often, and it's completely wrong. In fact, due to how common this incorrect pattern is, [the Rustonomicon specifically points this out](https://doc.rust-lang.org/nomicon/transmutes.html).
> - Transmuting an & to &mut is UB
> - Transmuting an & to &mut is always UB
> - No you can't do it
> - No you're not special
bors [Sat, 5 Jan 2019 14:04:31 +0000 (14:04 +0000)]
Auto merge of #3635 - matthiaskrgr:revert_random_state_3603, r=xfix
Revert the random_state lint.
Remove the random_state lint until it or rustc has been fixed to no longer crash with debug assertions (see #3628)
We can't update clippy in the rustc repo because of this which is blocking nightlies because toolstate is already broken.
bors [Sat, 5 Jan 2019 08:51:13 +0000 (08:51 +0000)]
Auto merge of #3627 - detrumi:use_self_local_macro, r=phansch
Trigger `use_self` lint in local macros
Closes #2098
The test currently only covers local macros. #2098 suggested this:
> You could add the macro in question into the `mini_macro` subcrate
But that doesn't work for a `macro_rules`:
```
error: cannot export macro_rules! macros from a `proc-macro` crate type currently
```
So I suggest leaving out the test for external macros, as using `in_external_macro` seems straigtforward enough. Alternatives would be to use to add an additional crate (overkill if you ask me), or test with a `proc-macro`.
bors [Thu, 3 Jan 2019 00:12:02 +0000 (00:12 +0000)]
Auto merge of #3607 - detrumi:limit_infinite_iter_to_known_types, r=phansch
Only trigger `infinite_iter` lint for infinitely allocating `collect()` calls
Fixes #3538
~Oh, I guess this should actually check other methods like `count` as well, not only `collect()`.~
Never mind, `collect` is the only of these functions that allocates a data structure.
bors [Mon, 31 Dec 2018 09:25:18 +0000 (09:25 +0000)]
Auto merge of #3590 - jorpic:i3559-if_same_then_else, r=phansch
Fix if_same_then_else false positive
This fixes false positive in #3559.
The problem was that `SpanlessEq` does not check patterns in declarations. So this two blocks considered equal.
```rust
if true {
let (x, y) = foo();
} else {
let (y, x) = foo();
}
```
Not sure if the proposed change is safe as `SpanlessEq` is used extensively in other lints, but I tried hard to come up with counterexample and failed.