Commit Graph

5879 Commits

Author SHA1 Message Date
Grzegorz
4f801a278d redundant closure triggers for fnptrs and closures 2019-04-20 22:20:14 +02:00
Grzegorz
aa9cf07d56 redundant closure for functions restricted to FnDefs 2019-04-19 15:14:49 +02:00
bors
0d9ef393b8 Auto merge of #3990 - felixrabe:patch-1, r=flip1995
Typo

changelog: none
2019-04-18 23:16:15 +00:00
bors
77fbdb6494 Auto merge of #3978 - phansch:rustfix_len_zero, r=flip1995
Add run-rustfix for len_zero lint

* Extracts len_without_is_empty into separate file
* Adds `// run-rustfix` to `tests/ui/len_zero.rs`

cc #3630
2019-04-18 21:18:23 +00:00
Felix Rabe
b4f2200d5c
Typo 2019-04-18 15:08:14 +02:00
bors
c6e43b1ba7 Auto merge of #3954 - andrehjr:add-lint-path-buf-overwrite, r=flip1995
Add Lint PathBufPushOverwrite

Closes #3923

This is a very simple Lint that checks if push is being called with a Root Path. Because that can make it overwrite the previous path.

I used std::path::Path to check if it's root, in order to keep it working across windows/linux environments instead of checking for '/'. Is that alright?

On the `if_chain!` block, Is there a way to make it short while getting the value of the first argument? I got the example from other lints.

Note that this is first Lint, I hope I got everything covered  🚀
2019-04-18 11:29:43 +00:00
André Luis Leal Cardoso Junior
7e9cb5b84a Add lint PathBufPushOverwrite 2019-04-18 08:05:55 -03:00
bors
6feed2713c Auto merge of #3985 - phansch:move_some_cast_tests, r=flip1995
Move two cast_lossless tests to their correct files

First part of checking off the `tests/ui/cast.rs` checkbox in #3630.
2019-04-18 10:06:55 +00:00
bors
95e537b039 Auto merge of #3987 - phansch:rustfix_option_map_or_none, r=flip1995
Add run-rustfix for option_map_or_none lint

* Extracts `option_map_or_none` tests into separate file
 * Adds `// run-rustfix` to `tests/ui/option_map_or_none.rs`

cc #3630
2019-04-18 09:43:42 +00: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
bors
58e12130e4 Auto merge of #3968 - kraai:lint-pass-macros, r=flip1995
Lint pass macros
2019-04-18 07:24:35 +00:00
Philipp Hansch
0f69aac3d9
Add run-rustfix for option_map_or_none lint 2019-04-18 08:12:59 +02:00
Philipp Hansch
8163a1a5f8
Move two cast_lossless tests to their correct files
First part of checking off the `tests/ui/cast.rs` checkbox in #3630.
2019-04-18 06:54:32 +02: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
ef29db773e Add tests for declare_lint_pass and impl_lint_pass 2019-04-17 09:35:23 -07:00
Matthew Kraai
753c39672e Use lint pass macros
Fixes #3917.
2019-04-17 09:35:22 -07:00
Matthew Kraai
24bb63383a Document declare_lint_pass! 2019-04-17 06:51:21 -07:00
flip1995
ce87051779 Fix lint_without_lint_pass internal lint 2019-04-17 06:51:21 -07:00
bors
3e760cc93a Auto merge of #3926 - flip1995:def_path_uplift, r=phansch
Use {get,match}_def_path from rustc

This is a follow up of the uplift of `{get,match}_def_path` to rustc.

~~This is blocked on rust-lang/rust#59779~~
2019-04-17 11:09:25 +00: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
ea25f044ec Auto merge of #3977 - phansch:add_rustfix_bool_comparison, r=flip1995
Add run-rustfix for bool_comparison lint

cc #3630
2019-04-17 02:35:02 +00:00
bors
1936368da1 Auto merge of #3976 - phansch:deref_addrof_rustfix, r=flip1995
Add run-rustfix for deref_addrof lint

* renames `tests/ui/reference.{rs,stderr}` to
  `tests/ui/deref_addrof.{rs,stderr}
* Moves small part of the testfile to a separate file as the lint
  triggered again on the fixed code (as intended)
* Adds `// run-rustfix` to `tests/ui/deref_addrof.rs`

cc #3630
2019-04-17 01:50:58 +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
bors
e4eee4baba Auto merge of #3972 - rust-lang:oli-obk-patch-1, r=flip1995,Manishearth
Create PULL_REQUEST_TEMPLATE

changelog: none

addresses https://github.com/rust-lang/rust-clippy/issues/3955#issuecomment-483567400
2019-04-16 23:52:59 +00:00
Philipp Hansch
bae7d29dbe
Add run-rustfix for len_zero lint
* Extracts len_without_is_empty into separate file
* Adds `// run-rustfix` to `tests/ui/len_zero.rs`
2019-04-16 21:46:07 +02:00
Philipp Hansch
90ddf0da6c
Add run-rustfix for bool_comparison lint 2019-04-16 20:42:54 +02:00
Philipp Hansch
d1e84c615c
Add run-rustfix for deref_addrof lint
* renames `tests/ui/reference.{rs,stderr}` to
  `tests/ui/deref_addrof.{rs,stderr}
* Moves small part of the testfile to a separate file as the lint
  triggered again on the fixed code (as intended)
* Adds `// run-rustfix` to `tests/ui/deref_addrof.rs`
2019-04-16 20:32:54 +02: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
flip1995
118f7d54c4
Remove rust-toolchain file from clippy_dev 2019-04-16 17:17:07 +02:00
Oliver Scherer
3b0185be45
Update adding_lints.md 2019-04-16 15:16:08 +02:00
Oliver Scherer
d383a12deb
Update PULL_REQUEST_TEMPLATE 2019-04-16 15:15:19 +02:00
Oliver Scherer
f33cbc152d
Add new lint checklist 2019-04-16 13:30:46 +02:00
Oliver Scherer
275dbec86d
Create PULL_REQUEST_TEMPLATE 2019-04-16 11:04:42 +02:00
bors
3e8d992bd8 Auto merge of #3970 - rust-lang:map_copied, r=flip1995
Suggest .copied() instead of .cloned() in map_clone where applicable

partial fix for https://github.com/rust-lang/rust-clippy/issues/3958

changelog: Improve suggestion in `map_clone` to suggest `.copied()` where applicable
2019-04-16 07:29:35 +00:00
Manish Goregaokar
e9cde416ba Only suggest .copied() for Option right now 2019-04-15 15:44:09 -07:00
Manish Goregaokar
ad2c65bd1b Also suggest .copied() when .clone() is called on a Copy type 2019-04-15 14:39:41 -07:00
Manish Goregaokar
d2f7ae70ae Suggest .copied() instead of .cloned() in map_clone when dealing with references 2019-04-15 14:32:39 -07:00
flip1995
445fa3b529
Deny rustc internal lints 2019-04-15 13:21:52 +02:00
flip1995
5361b842d1
Remove clippy::default_hash_types internal lint 2019-04-15 13:21:52 +02:00
flip1995
0973f68fb8
Enable -Zunstable-options in .cargo/config 2019-04-15 13:03:07 +02:00
bors
fbb3a47b90 Auto merge of #3961 - rust-lang:rustup, r=matthiaskrgr
Rust upgrade to rustc 1.35.0-nightly (9cd61f025 2019-04-14)

Handles breakages from https://github.com/rust-lang/rust/pull/59877

r? @oli-obk @matthiaskrgr
2019-04-14 21:08:00 +00:00
Manish Goregaokar
2156f6733e Clean up unused cx parameters 2019-04-14 13:23:43 -07:00
Manish Goregaokar
3c93a95b1f HirIdify ReadVisitor 2019-04-14 13:18:34 -07:00
Manish Goregaokar
0c6956f8ce Use _from_hir_id APIs 2019-04-14 13:15:20 -07:00
Manish Goregaokar
1b2f2be085 Remove now-unnecessary calls to node_to_hir_id 2019-04-14 13:11:31 -07:00
bors
6505794bc6 Auto merge of #3960 - phansch:fix_except, r=flip1995
Remove `except` in suspicious_else_formatting

96c34e85 contains the fix:

This was causing two different ICEs in #3741. The first was fixed in #3925.

The second one is fixed with this commit: We just don't `expect` anymore.
If the snippet doesn't contain an `else`, we stop emitting the lint because
it's not a suspiciously formatted else anyway.

Unfortunately I wasn't able to provide a minimal test case, but I think it's
fine since it's just ignoring the `None` case now.

And ad27e3ff cleans up the lint code to use `if_chain`.

Fixes #3741 once more.
2019-04-14 15:56:58 +00:00
bors
422ae77cae Auto merge of #3956 - rust-lang:beta-clog, r=phansch
Beta changelog

Maintain a changelog for beta so the release team can easily include important additions in the release blog posts.

r? @phansch, @oli-obk
2019-04-14 15:17:40 +00:00
Manish Goregaokar
737e45ad2d Link to ICEs 2019-04-14 08:17:01 -07:00