Commit graph

3183 commits

Author SHA1 Message Date
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
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