Commit graph

3272 commits

Author SHA1 Message Date
bors
45196cee02 Auto merge of #4690 - lzutao:fix-test-on-non-amd64, r=flip1995
generate stderr file on 32bit pointer system

changelog: none
2019-12-01 18:39:21 +00:00
Lzu Tao
5488672d1f account for external macro in MISSING_INLINE_IN_PUBLIC_ITEMS lint 2019-12-01 19:38:01 +07:00
Lzu Tao
142b289a51 chore: fix and split some ui tests on 32bit system 2019-12-01 19:07:02 +07:00
Andre Bogus
ef7587d957 Less needless_doctest_main false positives
This checks if a) the `fn main() {}` function is empty or if the doctest contains a `static`. In both cases don't lint.
2019-11-29 21:47:26 +01:00
Philipp Hansch
c1ccba005f
fmt 2019-11-29 20:47:50 +01:00
Philipp Hansch
ad6d8a4700
Make triggering this lint less likely 📎 2019-11-29 20:47:50 +01:00
Philipp Hansch
676f14baa0
Add custom ICE message that points to Clippy repo
This utilizes https://github.com/rust-lang/rust/pull/60584 by setting
our own `panic_hook` and pointing to our own issue tracker instead of
the rustc issue tracker.

This also adds a new internal lint to test the ICE message.

**Potential downsides**

* This essentially copies rustc's `report_ice` function as
  `report_clippy_ice`. I think that's how it's meant to be implemented, but
  maybe @jonas-schievink could have a look as well =)

  The downside of more-or-less copying this function is that we have to
  maintain it as well now.
  The original function can be found [here][original].
* `driver` now depends directly on `rustc` and `rustc_errors`

Closes #2734

[original]: 59367b074f/src/librustc_driver/lib.rs (L1185)
2019-11-29 20:47:47 +01:00
bors
04036877ef Auto merge of #4863 - phansch:use_self, r=flip1995
Move use_self to nursery

Closes #4859

We have a lot of false positives in this lint, so I think it makes sense
to move this to the nursery until they are resolved.

changelog: Move `use_self` lint to nursery, due to many false positives
2019-11-29 18:17:41 +00:00
flip1995
fd7eca2baf
Run update_lints 2019-11-29 14:50:19 +01:00
flip1995
604e6ba0e2
Add projections check to EUV for escape analysis 2019-11-29 12:57:10 +01:00
flip1995
b2523afae4
Use infer_ctxt 2019-11-29 11:12:19 +01:00
Philipp Hansch
70a2a29453
Move use_self to nursery
Closes #4859

We have a lot of false positives in this lint, so I think it makes sense
to move this to the nursery until they are resolved.

changelog: Move `use_self` lint to nursery, due to many false positives
2019-11-29 07:51:49 +01:00
Manish Goregaokar
45842e5131 Fix categorizations 2019-11-28 07:33:12 -08:00
Manish Goregaokar
c1c5c3522d Fix arguments on ExprUseVisitor::new 2019-11-28 07:20:37 -08:00
Manish Goregaokar
dc9d839410 euv moved from middle to typeck 2019-11-28 07:17:56 -08:00
Manish Goregaokar
85bb66480c cmt_ -> Place 2019-11-28 07:09:02 -08:00
bors
b5a6714155 Auto merge of #4849 - flip1995:deny_warnings, r=phansch
Deny warnings in CI

Removes the `debugging` feature, that wasn't used anymore and adds/enables the `deny-warnings` feature for every sub-crate of Clippy.

changelog: none
2019-11-28 10:27:46 +00:00
bors
dbdd75ab52 Auto merge of #4855 - phansch:rollup-x7yail7, r=phansch
Rollup of 3 pull requests

Successful merges:

 - #4832 (Add some positive examples to lint docs)
 - #4842 ([comparison_chain] #4827 Check `core::cmp::Ord` is implemented)
 - #4847 (fixing a typo)

Failed merges:

changelog: none

r? @ghost
2019-11-28 09:30:16 +00:00
Phil Hansch
a05f3cb9a1
Rollup merge of #4847 - rust-lang:offest, r=phansch
fixing a typo

changelog: none
2019-11-28 10:19:06 +01:00
Phil Hansch
1165176840
Rollup merge of #4842 - timbodeit:comparison-chain-false-positive-4827, r=flip1995
[comparison_chain] #4827 Check `core::cmp::Ord` is implemented

Only emit `comparison_chain` lint, if `cmp` is actually available on the type being compared. Don't emit lint in cases where only `PartialOrd` is implemented.

I haven't yet fully understood [Adjustments](https://doc.rust-lang.org/nightly/nightly-rustc/rustc/ty/adjustment/struct.Adjustment.html). I would appreciate, if someone could double check whether my usage of [expr_ty](https://doc.rust-lang.org/nightly/nightly-rustc/rustc/ty/struct.TypeckTables.html#method.expr_ty) in `clippy_lints/src/comparison_chain.rs:91` is correct or if there are cases where using [expr_ty_adjusted](https://doc.rust-lang.org/nightly/nightly-rustc/rustc/ty/struct.TypeckTables.html#method.expr_ty_adjusted) would lead to a different result when used with `utils::implements_trait`.

---

fixes #4827
changelog: [comparison_chain] Check `core::cmp::Ord` is implemented
2019-11-28 10:19:05 +01:00
Phil Hansch
6686892cbf
Rollup merge of #4832 - dario23:i4829, r=phansch
Add some positive examples to lint docs

fixes #4829
changelog: Add some positive examples to lint docs
2019-11-28 10:19:04 +01:00
bors
f3288eb48d Auto merge of #4851 - daxpedda:float-arithmetic, r=flip1995
Remove negative float literal checks.

Fixes #4850.

changelog: Remove negative float literal checks.
2019-11-28 09:11:45 +00:00
bors
d377486561 Auto merge of #4821 - Areredify:as_conversions, r=flip1995
Add `as_conversions` lint

changelog: closes #4771, adding a new pedantic allow-by-default lint that lints against any usage of `as`.
2019-11-28 08:53:36 +00:00
bors
d6accfcc82 Auto merge of #4808 - euclio:string-lit-as-bytes, r=phansch
trigger string_lit_as_bytes when literal has escapes

---

changelog: fix string_lit_as_bytes false negative

Depends on rust-lang/rust#66349.

Fixes #4796.
2019-11-28 07:26:04 +00:00
Lzu Tao
d0e0ffa99f make use of Result::map_or 2019-11-28 10:52:20 +07:00
Manish Goregaokar
40c91ec758 config.usize_ty -> config.ptr_width
From http://github.com/rust-lang/rust/pull/66719
2019-11-27 15:09:48 -08:00
Manish Goregaokar
e381143a6b More borrowkind fixes 2019-11-27 15:09:48 -08:00
Manish Goregaokar
3430bc1bc5 Re-add wildcards for BorrowKind in some places 2019-11-27 15:09:48 -08:00
Manish Goregaokar
341e266508 Add BorrowKind::Ref 2019-11-27 14:39:28 -08:00
Andy Russell
d33ad45d7d
trigger string_lit_as_bytes when literal has escapes 2019-11-26 17:07:17 -05:00
daxpedda
e46bedca3c
Remove negative float literal checks. 2019-11-25 19:23:28 +01:00
flip1995
1d3ec29880
Remove unused debugging feature 2019-11-25 17:23:07 +01:00
Mikhail Babenko
9ec8888b91 implemented as_conversions lint
actuall add files

add better example and change pedantic to restriction
2019-11-25 18:12:52 +03:00
flip1995
6eeac46b91
Run rustfmt 2019-11-25 15:20:10 +01:00
Andre Bogus
47ef5394de fixing a typo 2019-11-25 14:06:34 +01:00
flip1995
d2d62de841
Rustup to rust-lang/rust#64856 2019-11-25 13:56:24 +01:00
flip1995
d43c424145
Rustup to rust-lang/rust#66671 2019-11-25 13:18:38 +01:00
Tim Bodeit
fff9a8ea9c [comparison_chain] #4827 Check core::cmp::Ord is implemented
Only emit lint, if `cmp` is actually available on the type being
compared. Don't emit lint in cases where only `PartialOrd` is
implemented.
2019-11-24 10:00:06 +01:00
bors
cc35165f52 Auto merge of #4840 - flip1995:rollup-jqk3a3i, r=flip1995
Rollup of 5 pull requests

Successful merges:

 - #4730 (Fix check_infinite_loop (while_immutable_condition) by checking for break or return inside loop body)
 - #4766 (Fix false positive in derive_hash_xor_eq)
 - #4811 (Literal Representation Restructure)
 - #4820 (doc: fix the comment above the lint function)
 - #4830 (use more efficient code to generate repeated string)

Failed merges:

r? @ghost

changelog: none
2019-11-23 17:40:57 +00:00
Philipp Krones
b4524004e0
Rollup merge of #4830 - lzutao:str-repeat, r=flip1995
use more efficient code to generate repeated string

see https://rust.godbolt.org/z/z9vrFP for comparison

changelog: none
2019-11-23 18:16:03 +01:00
Philipp Krones
ae69bc4980
Rollup merge of #4820 - guanqun:comment-fix, r=flip1995
doc: fix the comment above the lint function

it's a simple comment fix.

---

changelog: none
2019-11-23 18:16:01 +01:00
Philipp Krones
623d8c4640
Rollup merge of #4811 - mikerite:lit_repr_20191113, r=flip1995
Literal Representation Restructure

This pull request restructures the literal_representation module to be easier to understand and maintain. I split the changes into a lot of commits to make reviewing easier.

changelog: none
2019-11-23 18:16:00 +01:00
Philipp Krones
93d84d7dda
Rollup merge of #4766 - phansch:fix_fp_in_derive_hash_xor_eq, r=flip1995
Fix false positive in derive_hash_xor_eq

This fixes a false positive in derive_hash_xor_eq where the lint was
triggering on user-defined traits called `Hash`.

changelog: Fix false positive in `derive_hash_xor_eq`

Fixes #4658
2019-11-23 18:15:59 +01:00
Philipp Krones
016857db65
Rollup merge of #4730 - yerke:fix-check_infinite_loop, r=flip1995
Fix check_infinite_loop (while_immutable_condition) by checking for break or return inside loop body

changelog: Fix check_infinite_loop (while_immutable_condition) by checking for break or return inside loop body
fixes #4648
2019-11-23 18:15:58 +01:00
flip1995
7cc8fa2e25
Fix fallout 2019-11-23 18:09:09 +01:00
flip1995
9b4faf97f3
Run update_lints 2019-11-23 17:57:28 +01:00
flip1995
7db973d06f
Merge remote-tracking branch 'FlorianRohm/issue/4623' into rollup-new-lints 2019-11-23 17:56:13 +01:00
flip1995
353668ee6c
Merge remote-tracking branch 'Areredify/large_stack_arrays' into rollup-new-lints 2019-11-23 17:55:10 +01:00
flip1995
213765a1d3
Merge remote-tracking branch 'popzxc/if-same-cond-fn' into rollup-new-lints 2019-11-23 17:54:26 +01:00
flip1995
d151ef7437
Merge remote-tracking branch 'upstream/zst-offset' into rollup-new-lints 2019-11-23 17:53:41 +01:00
Yerkebulan Tulibergenov
1cba0c9f7d fix check_infinite_loop by checking for break or return inside loop body 2019-11-22 09:13:46 -08:00
flip1995
e4636f3c39
Rustup to rust-lang/rust#66515
Fixes #4835
2019-11-22 13:47:33 +01:00
flip1995
3c308b86c8
Remove never_type feature
Stablized in rust-lang/rust#65355
2019-11-22 13:47:33 +01:00
Igor Aleksanov
bbb8cd4fbb Implement if_same_cond_fn lint
Run ./util/dev

Revert changelog entry

Rename lint to same_functions_in_if_condition and add a doc example

Add testcases with different arg in fn invocation
2019-11-20 06:54:46 +03:00
Johannes Schilling
c6e6b292bd add a good example for the approx_const lint 2019-11-19 20:14:09 +01:00
Johannes Schilling
c58a5c6272 Add suggested good cases in docs for lifetimes lint 2019-11-19 20:03:41 +01:00
lzutao
d229d91d88
use usize::from
Co-Authored-By: Mateusz Mikuła <mati865@users.noreply.github.com>
2019-11-19 23:47:18 +07:00
Lzu Tao
4da0da9281 use more efficient code to generate repeated string
see https://rust.godbolt.org/z/z9vrFP for comparison
2019-11-19 23:08:50 +07:00
Manish Goregaokar
aa5a95f00c Rustup to rustc 1.41.0-nightly (a0d40f8bd 2019-11-18) 2019-11-18 23:49:58 -08:00
Andre Bogus
c21b198576 New lint: zst_offset 2019-11-15 22:39:27 +01:00
Guanqun Lu
f2d8197110 doc: fix the comment above the lint function 2019-11-16 01:55:06 +08:00
Florian Rohm
73806b72a9 register new lint "tabs in doc comments" and update readme 2019-11-15 16:26:30 +01:00
Florian Rohm
f8f7800b18 add new lint tabs in doc comments 2019-11-15 16:25:47 +01:00
Yuki Okushi
0736dd9dfe Rustup rust-lang/rust#66233 2019-11-14 17:44:23 +09:00
Michael Wright
ceb0b2d41a literal repr: ignore more warnings in macros 2019-11-14 08:19:02 +02:00
Michael Wright
75e2dcf56b literal representation: simplification
Simplify calculation in grouping. Add test case to ensure `count()`
can't be zero in that branch.
2019-11-14 07:42:04 +02:00
Areredify
7fddac0404 Add new lint: large stack array
added documentation

minor style fix

change as to ::from

add ignore to doc

include threshold in lint message/make suggestion more apparent/use Scalar api instead of matching

style fix

shange snippet_opt to snippet
2019-11-13 21:44:29 +03:00
Michael Wright
2e9d173be1 literal representation restructure 12
Export function for formatting literals and remove crate visibility from
other items.
2019-11-13 08:28:50 +02:00
Michael Wright
eb9caf3050 literal representation restructure 11
Rename `grouping_hint` to `format` and use the term consistently.
2019-11-13 08:28:06 +02:00
Michael Wright
a8ca8a21c1 literal representation restructure 10
Rename DigitInfo to NumericLiteral
2019-11-13 08:28:01 +02:00
Michael Wright
a9c5a599e3 literal representation restructure 9
Only store valid suffixes (and not mistyped suffixes) in DigitInfo.
Check for mistyped suffixes later and not when DigitInfo is created.
This opens the door to more sophisticated mistyped suffix checks later.
2019-11-13 08:27:54 +02:00
Michael Wright
a58b980bd8 literal representation restructure 8
Store the digit parts directly in DigitInfo since we need them anyway.
2019-11-13 08:27:49 +02:00
Michael Wright
b62543f756 literal representation restructure 7
Replace `do_lint` with `get_group_size`. Return `None` if there are no
groups.
2019-11-13 08:27:42 +02:00
Michael Wright
abf62d8011 literal representation restructure 6
Add `group_digits` helper function.
2019-11-13 08:27:37 +02:00
Michael Wright
ec664e84bf literal representation restructure 5
Use `split_digit_parts` in `check_lit`.
2019-11-13 08:27:27 +02:00
Michael Wright
2d244d3358 literal representation restructure 4
Simplify `grouping_hint` by splitting digits into parts and handling
one at a time.

Fixes #4762
2019-11-13 08:27:19 +02:00
Michael Wright
2e8946a6de literal representation restructure 3
Move suffix check into `check_lit` so that it isn't done repeatedly.
2019-11-13 08:27:14 +02:00
Michael Wright
2dbd34ffe8 literal representation restructure 2
Consolidate warning handling using "poor man's try".
2019-11-13 08:27:05 +02:00
Michael Wright
8f5b4f3f5c literal representation restructure 1
Combine macro expansion checks. Indentation is a little strange to
avoid rustfmt issue.
2019-11-13 08:26:52 +02:00
Andre Bogus
5f0f67375d no more must-use-candidate on trait impls 2019-11-12 23:36:22 +01:00
Andy Russell
add766493a
don't warn on CRLF in with_newline lints 2019-11-12 08:50:22 -05:00
bors
2646b108d5 Auto merge of #4803 - tomprogrammer:issue-4732, r=phansch
Fix false positive in explicit_counter_loop lint

When the counter was used in a closure after the loop the lint didn't detect the
usage of the counter correctly.

changelog: Fix false positive in `explicit_counter_loop`

Fixes #4732
2019-11-11 19:24:20 +00:00
Manish Goregaokar
e9a3e54910 MutImmutable -> Immutable, MutMutable -> Mutable, CaptureClause -> CaptureBy 2019-11-11 10:58:39 -08:00
bors
79d3b30cd7 Auto merge of #4801 - mikerite:to_digit_is_some, r=flip1995
To digit is some

Add a lint that recommends replacing `to_digit().is_some()` with `is_digit()` on `char`s

changelog: Add lint `to_digit_is_some`
2019-11-11 11:28:27 +00:00
Thomas Bahn
c88afce6fc Fix false positive in explicit_counter_loop lint
When the counter was used in a closure after the loop the lint didn't detect the
usage of the counter correctly.
2019-11-11 11:36:53 +01:00
Philipp Hansch
78b7e8544b
Fix false positive in derive_hash_xor_eq
This fixes a false positive in derive_hash_xor_eq where the lint was
triggering on user-defined traits called `Hash`.
2019-11-11 07:59:53 +01:00
bors
338f5e6801 Auto merge of #4780 - flip1995:ice_4775, r=phansch
Fix ICE #4775

Fixes #4775

changelog: Fix ICE with const_generics
2019-11-11 06:23:27 +00:00
Michael Wright
c1fd75005e Fix breakage due to rust-lang/rust#65324 2019-11-11 06:22:50 +02:00
Michael Wright
89b966cdf1 Really fix to_digit_is_some documentation 2019-11-10 18:00:04 +02:00
Michael Wright
9aefae4226 Fix to_digit_is_some documentation 2019-11-10 17:58:17 +02:00
Michael Wright
a9b5b36769 Fix to_digit_is_some dogfood errors 2019-11-10 15:53:08 +02:00
Michael Wright
5817a4fa06 Add to_digit_is_some lint 2019-11-10 15:52:59 +02:00
Manish Goregaokar
3ef852b74c Rustup to rustc 1.40.0-nightly (ac162c6ab 2019-11-09) 2019-11-09 17:04:42 -08:00
bors
b0b3dc6e76 Auto merge of #4776 - mikerite:fix-4727, r=flip1995
Fix crash in `use-self` lint

Fixes #4727

changelog: Fix crash in `use-self` lint
2019-11-08 22:06:21 +00:00
HMPerson1
94b36d9ca4
dogfood 2019-11-08 15:41:54 -05:00
HMPerson1
d4758420e6
Rustup rust-lang/rust#66188 2019-11-08 15:12:08 -05:00
Michael Wright
9c48a2c39a Merge branch 'master' into fix-4727 2019-11-08 07:15:16 +02:00
Lzu Tao
ff5bf67b94 remove unused warnings 2019-11-08 10:23:42 +07:00
Lzu Tao
acbe224f6a rustup https://github.com/rust-lang/rust/pull/65916 2019-11-08 10:23:42 +07:00
bors
4be144af87 Auto merge of #4697 - Licenser:no-exit, r=flip1995
restriction lint for `std::process::exit`

Addition to #4655 - adds the lint checking for `std::process::exit`

changelog: add restriction lint for `std::process::exit`
2019-11-07 22:05:51 +00:00