Commit Graph

2570 Commits

Author SHA1 Message Date
Manish Goregaokar
19cfb84405 Start handling desugarings in author lint 2019-05-10 23:43:58 -07:00
Manish Goregaokar
0499184201 Ignore desugarings in macro checks 2019-05-10 23:40:42 -07:00
Manish Goregaokar
5661e5947f Add IfDesugar to desugaring_name 2019-05-10 23:40:42 -07:00
Manish Goregaokar
26ebc3e9a1 Fix consts.rs 2019-05-10 23:40:42 -07:00
Manish Goregaokar
c9ed92ce20 More uses of higher::if_block 2019-05-10 23:40:42 -07:00
Manish Goregaokar
69b1da4d82 Remove some unnecessary If arms 2019-05-10 23:40:42 -07:00
Manish Goregaokar
da8b56d99a Fix needless_bool.rs 2019-05-10 23:40:42 -07:00
Manish Goregaokar
09a93291ec Fix question_mark.rs 2019-05-10 23:40:42 -07:00
Manish Goregaokar
f40c77a776 Fix shadow.rs 2019-05-10 23:40:42 -07:00
Manish Goregaokar
62897747fd Fix unwrap.rs 2019-05-10 23:40:42 -07:00
Manish Goregaokar
e7af60f258 Add util function for desugaring if block 2019-05-10 23:40:42 -07:00
Andy Russell
9ede56f383
use derive feature over serde_derive crate 2019-05-09 13:05:34 -04:00
Matthias Krüger
857c2c53bf rustup https://github.com/rust-lang/rust/pull/60586
cc https://github.com/rust-lang/rust/issues/60623
2019-05-08 06:58:37 +02:00
Matthias Krüger
d618637c05 Rustup to rustc 1.36.0-nightly (13fde05b1 2019-05-03) 2019-05-03 22:28:34 -07:00
Jean Mertz
ff244b6c43
Fix link in into_iter_on_array documentation
The non-inline variant wasn't being rendered correctly.

see: https://rust-lang.github.io/rust-clippy/master/index.html#into_iter_on_array
2019-05-03 17:38:13 +02:00
bors
8b906f94f3 Auto merge of #4053 - euclio:too-many-args-span, r=flip1995
remove function body from "too many args" span

changelog: Remove the function body from the "too many arguments" span.
2019-05-03 07:26:55 +00:00
Andy Russell
9253506112
remove function body from "too many args" span 2019-05-02 10:36:59 -04:00
bors
8151a17422 Auto merge of #4049 - airt:fix-4033-search_is_some, r=flip1995
Fix #4033 search_is_some

Fixes #4033.

Suggest `any(|x| ..)` instead of `any(|&x| ..)` for `find(|&x| ..).is_some()` (Lint [search_is_some](https://rust-lang.github.io/rust-clippy/master/index.html#search_is_some))

FnDecl of `find`:

```rust
fn find<P>(&mut self, mut p: P) -> Option<Self::Item> where
    P: FnMut(&Self::Item) -> bool
```

FnDecl of `any`:

```rust
fn any<F>(&mut self, mut f: F) -> bool where
    F: FnMut(Self::Item) -> bool
```

If match on `|&_|` in closure of `find`, only use `|_|` in the suggestion.

PS. It's the first time that I have used the `hir` API, please correct me if there is any mistake 😺
2019-05-02 08:45:02 +00:00
bors
1cf5d7f04c Auto merge of #4035 - JoshMcguigan:useless_let_if_seq-3043, r=oli-obk
useless_let_if_seq handle interior mutability

fixes #3043

This passes all tests, including a new one specifically dealing with a type with interior mutability. The main thing I'm unsure of is whether the span I used in the call to `is_freeze` is the most appropriate span to use, or if it matters.
2019-05-02 07:03:28 +00:00
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
airt
d063516c85 check closure arguments before use it 2019-05-01 04:41:00 +08:00
airt
5d6a100f81 format code 2019-05-01 04:03:51 +08: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
airt
c3fde34fd5 fix suggestion for search_is_some 2019-05-01 03:11:58 +08:00
airt
bd0b75f6c3 fix suggestion for search_is_some naively 2019-05-01 01:08:16 +08: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
Josh Mcguigan
2bbe8be8d0 useless_let_if_seq handle interior mutability 2019-04-25 19:07:01 -07: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