Commit graph

2546 commits

Author SHA1 Message Date
Matthias Krüger
f195680edb more Use->DropTemps fixes 2019-05-01 23:04:35 +02:00
Matthias Krüger
24e856f10a rustup https://github.com/rust-lang/rust/pull/60417/
cc https://github.com/rust-lang/rust/issues/60448
2019-05-01 22:18:16 +02:00
Matthias Krüger
6967cf59a4 clippy-driver: use rustc_tools_util to get version info.
This will add git hash information to `clippy-driver -V` output.
2019-05-01 10:43:16 +02:00
André Luis Leal Cardoso Junior
e428862c95 Update find(p).map(p) occurrences to use find_map(p) 2019-04-30 16:45:32 -03:00
André Luis Leal Cardoso Junior
b411391f8e Add lints for find_map 2019-04-30 16:45:28 -03:00
Manish Goregaokar
83519d3ca0 Rustup to rustc 1.36.0-nightly (f843ad60e 2019-04-30) 2019-04-29 22:31:39 -07:00
Manish Goregaokar
79f48d0573 Rustup to rustc 1.36.0-nightly (c7fcbfbf1 2019-04-29)
See https://github.com/rust-lang/rust/pull/60317
2019-04-28 22:42:16 -07:00
bors
78d13e007f Auto merge of #4043 - rust-lang:map-clone-iter, r=matthiaskrgr
Suggest .copied() for map_clone on iterators too

fixes https://github.com/rust-lang/rust-clippy/issues/3958

changelog: Make `map_clone` suggest the newly-stable `Iterator::copied()` when applicable

r? @mikerite @matthiaskrgr
2019-04-28 18:39:00 +00:00
Manish Goregaokar
770de14505 Suggest .copied() for map_clone on iterators too 2019-04-28 11:14:39 -07:00
Matthias Krüger
e01caad2a8 deps: bump toml from 0.4 to 0.5 2019-04-28 19:24:36 +02:00
Michael Wright
5ad79c2b3d Fix breakage due to rust-lang/rust#60225 2019-04-28 09:11:20 +02:00
bors
910d538ef1 Auto merge of #4008 - g-bartoszek:boxed-fnmut, r=phansch
Do not trigger redundant_closure for non-function types

fixes #3898

Added a check for the entity being called in the closure body to be a FnDef. This way lint does not trigger for ADTs (Box) but I'm not sure if it's correct and not too restrictive.

<!--
Thank you for making Clippy better!

We're collecting our changelog from pull request descriptions.
If your PR only updates to the latest nightly, you can leave the
`changelog` entry as `none`. Otherwise, please write a short comment
explaining your change.

If your PR fixes an issue, you can add "fixes #issue_number" into this
PR description. This way the issue will be automatically closed when
your PR is merged.

If you added a new lint, here's a checklist for things that will be
checked during review or continuous integration.

- [ ] Followed [lint naming conventions][lint_naming]
- [ ] Added passing UI tests (including committed `.stderr` file)
- [ ] `cargo test` passes locally
- [ ] Executed `util/dev update_lints`
- [ ] Added lint documentation
- [ ] Run `cargo fmt`

Note that you can skip the above if you are just opening a WIP PR in
order to get feedback.

Delete this line and everything above before opening your PR -->

changelog: Fix false positive in `redundant_closure` pertaining to non-function types
2019-04-25 18:13:47 +00:00
bors
6a0105e59f Auto merge of #4026 - cemiloten:working-on-#3981, r=flip1995
Attempt to fix #3981

Fixes #3981

Hi, hopefully this is correct, happy to have feedback.

changelog: Don't trigger `unnecessary_cast` inside a macro
2019-04-25 10:37:30 +00:00
cemil
8eae2d3707 Ignore unnecessary cast if inside macro 2019-04-25 12:06:20 +02:00
bors
8c0e038f6f Auto merge of #4029 - phansch:update_pulldown_cmark, r=oli-obk
Update pulldown_cmark to 0.5

We now no longer have to use our own wrapper around `Parser` and can use
the new `OffsetIter`.

changelog: none
2019-04-25 09:16:46 +00:00
Philipp Hansch
1f5a3c6e52
Rustup for https://github.com/rust-lang/rust/pull/59042 2019-04-25 07:29:23 +02:00
Philipp Hansch
32e877ce13
Update pulldown_cmark to 0.5
We now no longer have to use our own wrapper around `Parser` and can use
the new `OffsetIter`.
2019-04-24 22:54:12 +02:00
Matthew Kraai
5c7349d430 Remove approx_constant known problems
Fixes #4025.
2019-04-24 09:29:45 -07:00
bors
253601a91c Auto merge of #4024 - kraai:suppress-let_and_return-if-let-has-attributes, r=flip1995
Suppress let_and_return if let has attributes

Fixes #3882.

changelog: suppress `let_and_return` if `let` has attributes
2019-04-24 07:29:35 +00:00
Matthew Kraai
c0479402e4 Suppress let_and_return if let has attributes
Fixes #3882.
2019-04-23 23:32:16 -07:00
Matthew Kraai
9a43e09d77 Change "if types change" to "if you later change the type"
Fixes #3964.
2019-04-23 16:53:09 -07:00
bors
9897442f27 Auto merge of #4018 - rust-lang:or_fn_call_variants, r=oli-obk
Ignore non-const ctor expressions in or_fn_call

Fixes https://github.com/rust-lang/rust-clippy/issues/1338

Should have been fixed by #919, however that focuses on const ctor expressions only, and `.or(Some(local))` isn't const.

This also automatically ignores things like `.or(Some(local.clone())` which we don't actually want to do; I need to figure out what to do here.

changelog: Fixed false positive in [`or_fn_call`] pertaining to enum variant constructors

r? @oli-obk @phansch
2019-04-23 18:24:10 +00:00
Manish Goregaokar
f3455cda81 Rustup to rustc 1.36.0-nightly (fe0a415b4 2019-04-23) 2019-04-23 08:25:45 -07:00
Manish Goregaokar
7e2043de2f Ignore all enum and struct constructors in lints about *or(call()) 2019-04-23 08:01:42 -07:00
bors
d420589e1a Auto merge of #4013 - kraai:move-path_buf_push_overwrite-to-nursery, r=matthiaskrgr
Move path_buf_push_overwrite to nursery

See #4012.

changelog: move `path_buf_push_overwrite` to the nursery
2019-04-21 20:44:03 +00:00
Igor Matuszewski
930f1e6129 Use newly-introduced mutability query for statics
Fixes fallout from https://github.com/rust-lang/rust/pull/60124.
cc https://github.com/rust-lang/rust/issues/60154
2019-04-21 21:15:34 +02:00
Matthew Kraai
4171299632 Move path_buf_push_overwrite to nursery
See #4012.
2019-04-21 10:24:51 -07:00
Grzegorz
4f801a278d redundant closure triggers for fnptrs and closures 2019-04-20 22:20:14 +02:00
bors
54e80c7b34 Auto merge of #4007 - phansch:fix_allowing_toplevel_ref_arg, r=flip1995
Allow allowing of toplevel_ref_arg lint

I'm not sure why some lints need the `HirId` to be able to recognize the
lint level attributes, but this commit makes the lint level attributes
work for `toplevel_ref_arg`.

Fixes #2332

changelog: Allow allowing of `toplevel_ref_arg` lint
2019-04-20 18:22:53 +00:00
bors
7a6d5c00d3 Auto merge of #4006 - phansch:fix_module_name_repetitions_fp, r=flip1995
Fix false positive in module_name_repetitions lint

This lint was triggering on modules inside expanded attrs, like
for example `#[cfg(test)]` and possibly more.

It was not reporting a location in #3892 because `span.lo()` and `span.hi()` both were 0.

Fixes #3892

changelog: Fix false positive in `module_name_repetitions` lint
2019-04-20 16:58:51 +00:00
Philipp Hansch
158aa39a7c
Allow allowing of toplevel_ref_arg lint
I'm not sure why some lints need the `HirId` to be able to recognize the
lint level attributes, but this commit makes the lint level attributes
work for `toplevel_ref_arg`.
2019-04-19 15:18:32 +02:00
Grzegorz
aa9cf07d56 redundant closure for functions restricted to FnDefs 2019-04-19 15:14:49 +02:00
Philipp Hansch
850c24edd3
Fix false positive in module_name_repetitions lint
This lint was triggering on modules inside expanded attrs, like
for example `#[cfg(test)]` and possibly more.
2019-04-19 12:53:03 +02:00
bors
12e8075d91 Auto merge of #3989 - flip1995:assert_on_const, r=phansch
Don't trigger assertions_on_constants on debug_assert!(false)

Fixes #3948
Fixes #3765

changelog: Fix `debug_assert!` false positive on `assertions_on_constants` lint
2019-04-19 09:57:35 +00:00
Felix Rabe
b4f2200d5c
Typo 2019-04-18 15:08:14 +02:00
flip1995
10cd28900f
Fix dogfood error 2019-04-18 13:37:20 +02:00
André Luis Leal Cardoso Junior
7e9cb5b84a Add lint PathBufPushOverwrite 2019-04-18 08:05:55 -03:00
flip1995
834ad76806
Remove code duplication 2019-04-18 12:04:46 +02:00
flip1995
40218bae0c
Format code 2019-04-18 11:50:45 +02:00
flip1995
be98df5ac3
Don't lint debug_assert!(false) 2019-04-18 11:47:39 +02:00
bors
b834dbb2d5 Auto merge of #3984 - phansch:bytecount_sugg, r=flip1995
Change naive_bytecount applicability to MaybeIncorrect

We can't use `MachineApplicable` here as applying the fix will cause
another error because `bytecount` would first have to be added to the
Cargo.toml.

Example:

```
error: You appear to be counting bytes the naive way
  --> $DIR/bytecount.rs:5:13
   |
LL |     let _ = x.iter().filter(|&&a| a == 0).count(); // naive byte count
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Consider using the bytecount crate: `bytecount::count(x, 0)`
```

Just replacing it with the suggestion is not enough.

cc #3630
2019-04-18 07:49:09 +00:00
Philipp Hansch
01ea9bd9d8
Change naive_bytecount applicability MaybeIncorrect
We can't use `MachineApplicable` here as applying the fix will cause
another error because `bytecount` would first have to be added to the
Cargo.toml.
2019-04-17 20:46:42 +02:00
Matthew Kraai
753c39672e Use lint pass macros
Fixes #3917.
2019-04-17 09:35:22 -07:00
flip1995
ce87051779 Fix lint_without_lint_pass internal lint 2019-04-17 06:51:21 -07:00
flip1995
840eac2c05
Use {get,match}_def_path from LateContext 2019-04-17 12:53:29 +02:00
flip1995
2f100e04af
Remove uplifted functions {get,match}_def_path from Clippy 2019-04-17 12:51:57 +02:00
bors
27d62cf603 Auto merge of #3966 - flip1995:internal_lints, r=oli-obk
Enable rustc internal lints

Closes #3965

I'm not 100% sure if enabling the `-Zunstable-options` flag in the `.cargo/config` file is the right place.
2019-04-17 04:46:19 +00:00
bors
1132caabff Auto merge of #3975 - phansch:has_placeholders, r=flip1995
Change while_let_loop applicability to HasPlaceholders

The suggestion has been changed at some point to use `..` in the suggested code.
Due to that we can't make the lint MachineApplicable anymore.

cc #3630
2019-04-17 01:14:27 +00:00
Philipp Hansch
e974d84d03
while_let_loop uses placeholders in suggestions
Due to that we can't make the lint MachineApplicable anymore.
2019-04-16 20:05:16 +02:00
Manish Goregaokar
e9cde416ba Only suggest .copied() for Option right now 2019-04-15 15:44:09 -07:00