Commit graph

2446 commits

Author SHA1 Message Date
Tim Nielens
1ac8b85c9f redundant_closure_call - pr review 2020-07-20 00:36:31 +02:00
Tim Nielens
9603d9652b redundant_closure_call - add support for shadowed closures 2020-07-20 00:30:43 +02:00
Tim Nielens
0fecaf1abc redundant_closure_call - extract lint from misc_early.rs, adapt to LatePass 2020-07-20 00:30:43 +02:00
Tim Nielens
c720d823e1 redundant_closure_call - don't lint when used more than once 2020-07-20 00:30:43 +02:00
ThibsG
442c8ae23b Fix FP for suspicious_arithmetic_impl from suspicious_trait_impl lint 2020-07-19 00:00:17 +02:00
JarredAllen
7c5d4a4145 Add test for correct behavior 2020-07-17 09:27:43 -07:00
bors
57678c8315 Auto merge of #5811 - JarredAllen:panic_multiple_args, r=phansch
Panic multiple args

changelog: Fixes bug with `panic` lint reported in #5767. I also did the same changes to the lints for `todo`, `unimplemented` and `unreachable`, so those lints should now also detect calls to those macros with a message.
2020-07-17 06:41:20 +00:00
Matthias Krüger
3618b97f59 fix typos (found by codespell) 2020-07-17 01:58:41 +02:00
JarredAllen
70a41a9281 Enable detecting multiple-argument panics 2020-07-16 16:51:12 -07:00
Leo Meira Vital
a0640457a9 Removing snippet from SHADOW_UNRELATED message. 2020-07-15 11:12:38 -03:00
bors
84cdce01cb Auto merge of #5798 - mikerite:fix-2277-2, r=yaahc
Add test for `needless_range_loop` issue

Closes #2277

This was fixed when we fixed #2542.

changelog: none
2020-07-14 17:23:31 +00:00
bors
128c5dec92 Auto merge of #5793 - warner:5783-nth-zero-next, r=flip1995
improve advice in iter_nth_zero

fixes #5783

*Please keep the line below*
changelog:  For iter_nth_zero, the "use .next()" replacement advice is on the last line of the code snippet, where it is vulnerable to truncation. Display that advice at the beginning instead.
2020-07-14 16:58:23 +00:00
Brian Warner
e83b3eb993 formatting nits 2020-07-14 09:20:19 -07:00
Matthias Krüger
126790999a new lint: Returning unit from closures expecting Ord
This lint catches cases where the last statement of a closure expecting
an instance of Ord has a trailing semi-colon. It compiles since the
closure ends up return () which also implements Ord but causes
unexpected results in cases such as sort_by_key.

Fixes #5080

reprise: rebase, update and address all concerns
2020-07-14 15:54:04 +02:00
flip1995
6f25adbd5a Merge commit '2ca58e7dda4a9eb142599638c59dc04d15961175' into clippyup 2020-07-14 14:59:59 +02:00
bors
2ca58e7dda Auto merge of #5732 - bjorn3:patch-1, r=flip1995
Rename collapsable_if fix suggestion to "collapse nested if block"

The name "try" is confusing when shown as quick fix by rust-analyzer

changelog: Rename `collapsable_if` fix suggestion to "collapse nested if block"
2020-07-14 09:39:01 +00:00
bors
12df6384b9 Auto merge of #5773 - giraffate:repeat_once, r=flip1995
Add a lint for `.repeat(1)`

changelog: New lint `repeat_once`

fix #3028.
2020-07-14 09:13:58 +00:00
Michael Wright
d067d0352b Add test for needless_range_loop issue
Closes #2277

This was fixed when we fixed #2542.
2020-07-14 08:35:03 +02:00
Brian Warner
201999ccfd improve advice in iter_nth_zero
The "use .next()" replacement advice is on the last line of the code snippet,
where it is vulnerable to truncation. Display that advice at the beginning
instead.

closes #5783
2020-07-13 10:59:45 -07:00
bjorn3
ff796b6d70 Rename collapsable_if fix suggestion to "collapse nested if block"
The name "try" is confusing when shown as quick fix by rust-analyzer
2020-07-13 17:54:57 +02:00
bors
4b8700879c Auto merge of #5792 - flip1995:rollup-torc1we, r=flip1995
Rollup of 5 pull requests

Successful merges:

 - #5443 (Some accuracy lints for floating point operations)
 - #5752 (Move range_minus_one to pedantic)
 - #5756 (unnecessary_sort_by: avoid linting if key borrows)
 - #5784 (Fix out of bounds access by checking length equality BEFORE accessing by index.)
 - #5786 (fix phrase in new_lint issue template)

Failed merges:

r? @ghost

changelog: rollup
2020-07-13 14:21:20 +00:00
Philipp Krones
32ef448bdb
Rollup merge of #5756 - ebroto:5754_sort_by, r=flip1995
unnecessary_sort_by: avoid linting if key borrows

changelog: Avoid linting if key borrows in [`unnecessary_sort_by`]

Fixes #5754
Closes #2313
2020-07-13 15:59:44 +02:00
Philipp Krones
019e281d15
Rollup merge of #5752 - chrisduerr:pedantic_ranges, r=flip1995
Move range_minus_one to pedantic

This moves the range_minus_one lint to the pedantic category, so there
will not be any warnings emitted by default. This should work around
problems where the suggestion is impossible to resolve due to the range
consumer only accepting a specific range implementation, rather than the
`RangeBounds` trait (see #3307).

While it is possible to work around this by extracting the boundary into
a variable, I don't think clippy should encourage people to disable or
work around lints, but instead the lints should be fixable. So hopefully
this will help until a proper implementation checks what the range is
used for.

*Please keep the line below*
changelog: move [`range_minus_one`] to pedantic
2020-07-13 15:59:42 +02:00
Philipp Krones
75d43aac73
Rollup merge of #5443 - thiagoarrais:issue-2040, r=flip1995
Some accuracy lints for floating point operations

This will add some lints for accuracy on floating point operations suggested by @clarfon in #2040 (fixes #2040).

These are the remaining lints:

- [x] x.powi(2) => x * x
- [x] x.logN() / y.logN() => x.logbase(y)
- [x] x.logbase(E) => x.log()
- [x] x.logbase(10) => x.log10()
- [x] x.logbase(2) => x.log2().
- [x] x * PI / 180 => x.to_radians()
- [x] x * 180 / PI => x.to_degrees()
- [x] (x + 1).log() => x.log_1p()
- [x] sqrt(x * x + y * y) => x.hypot(y)

changelog: Included some accuracy lints for floating point operations
2020-07-13 15:59:41 +02:00
bors
fa4a737fba Auto merge of #5790 - flip1995:rustup, r=flip1995
Rustup

r? @ghost

changelog: none
2020-07-13 13:53:11 +00:00
Manish Goregaokar
b57ceb45b0 Rollup merge of #72920 - oli-obk:const_transmute, r=RalfJung
Stabilize `transmute` in constants and statics but not const fn

cc #53605 (leaving issue open so we can add `transmute` to `const fn` later)

Previous attempt: #64011

r? @RalfJung

cc @rust-lang/wg-const-eval
2020-07-11 08:53:06 -07:00
Oliver Scherer
1eb0053dcd Stabilize transmute in constants and statics but not const fn 2020-07-11 09:22:17 +02:00
bors
7d611d9224 Auto merge of #5769 - robojumper:match_like_matches_macro, r=phansch
new lint: match_like_matches_macro

Suggests using the `matches!` macro from `std` where appropriate.

`redundant_pattern_matching` has been moved into the `matches` pass to allow suppressing the suggestion where `is_some` and friends are a better replacement.

changelog: new lint: `match_like_matches_macro`
2020-07-10 18:10:08 +00:00
Christian Duerr
afa4148cc6
Fix tests a bit more 2020-07-10 17:53:01 +02:00
Christian Duerr
b3c719608d
Fix test failures 2020-07-10 17:23:03 +02:00
Tamir Duberstein
cf91c54cc6 Avoid "whitelist"
Other terms are more inclusive and precise.
2020-07-10 07:39:28 -04:00
bors
45eea9a822 Auto merge of #5771 - montrivo:bugfix/single-match-else, r=matthiaskrgr
single_match_else - single expr/stmt else block corner case

One approach to fix #3489.
See discussion in the issue.

changelog: single_match_else - single expr/stmt else block corner case fix
2020-07-09 12:03:14 +00:00
Tim Nielens
dac19e3afc single_match_else - single expr/stmt else block corner case 2020-07-09 12:04:27 +02:00
Eduardo Broto
db1c946aaa unnecessary_sort_by: avoid linting if key borrows 2020-07-08 21:31:59 +02:00
robojumper
37d75da266 make match_like_matches_macro only apply to matches with a wildcard 2020-07-08 18:37:20 +02:00
Takayuki Nakata
5307cb5614 Add a lint for .repeat(1)
fix #3028.
2020-07-07 23:13:39 +09:00
Thiago Arrais
6be9491eac Reclassify powi(2) lint under suboptimal_flops 2020-07-06 13:45:43 -03:00
Thiago Arrais
6dc066fdb9 Includes TODO comment for hypot lint 2020-07-06 13:45:43 -03:00
Thiago Arrais
db7bc6b3bd Place radian lints under suboptimal_flops 2020-07-06 13:45:43 -03:00
Thiago Arrais
f5596826fa Better copy for lint message
Since x.log(y) is actually implemented as x.ln() / y.ln()
2020-07-06 13:45:43 -03:00
Thiago Arrais
076ec872ce Lint for to_radians and to_degrees 2020-07-06 13:45:39 -03:00
Thiago Arrais
0c8afa39ce Lint x.log(b) / y.log(b) => x.log(y) 2020-07-06 13:32:31 -03:00
robojumper
2e8a1be444 new lint: match_like_matches_macro 2020-07-06 18:25:20 +02:00
Thiago Arrais
f62798454c Lint (x * x + y * y).sqrt() => x.hypot(y) 2020-07-06 13:23:17 -03:00
Thiago Arrais
a6f1af75d7 Lint for x.powi(2) => x * x 2020-07-06 13:23:17 -03:00
JarredAllen
f73b455b99 Refactoring 2020-07-03 16:47:38 -07:00
JarredAllen
88c8afdddf Handle ref, mut, &, and &mut on the option 2020-07-03 16:47:38 -07:00
JarredAllen
b85796fe36 Properly parenthesize to avoid operator precedence errors 2020-07-03 16:47:38 -07:00
JarredAllen
82f8d4d6f1 Stop linting on macros and correctly use braces for constructs 2020-07-03 16:47:38 -07:00
JarredAllen
bf48a2d50d Lint for if let Some(x) = ... instead of Option::map_or 2020-07-03 16:47:38 -07:00
bors
57cdf2dc16 Auto merge of #4841 - phaylon:pattern-type-mismatch, r=flip1995
Added restriction lint: pattern-type-mismatch

changelog: Added a new restriction lint `pattern-type-mismatch`. This lint is especially helpful for beginners learning about the magic behind pattern matching. (This explanation might be worth to include in the next changelog.)
2020-07-03 16:41:26 +00:00
Robert Sedlacek
346ee968bb Adjusted expected STDERR 2020-07-03 18:12:29 +02:00
Robert Sedlacek
c3c402783f Added restriction lint: pattern-type-mismatch 2020-07-03 18:12:29 +02:00
ThibsG
2d5930a3da Don't lint for predicates generated in macros 2020-07-03 17:29:54 +02:00
ThibsG
d5a8f03a35 Take generic args into account for bounded type 2020-07-03 17:29:54 +02:00
ThibsG
754bfb1dc8 Add configurable threshold for type_repetition_in_bounds lint 2020-07-03 17:29:54 +02:00
flip1995
a7c58e66d4
Merge remote-tracking branch 'upstream/master' into rustup 2020-07-03 12:50:41 +02:00
Eduard-Mihai Burtescu
30c046ede4 Use 'tcx for references to AccessLevels wherever possible. 2020-07-03 00:04:48 +03:00
Philipp Hansch
d347d0cf59
Deprecate regex_macro lint 2020-07-01 13:05:41 +02:00
bors
36b7983580 Auto merge of #5758 - ebroto:5704_unnested_or_pats, r=flip1995
Require `or_patterns` to suggest nesting them

changelog: Require `#![feature(or_patterns)]` to trigger [`unnested_or_patterns`]

Fixes #5704
2020-06-30 22:23:23 +00:00
Eduardo Broto
bff6c435ef Require or_patterns to suggest nesting them 2020-07-01 00:15:21 +02:00
Eduardo Broto
c5d8f530e0 Move blanket_clippy_restriction_lints to "style" 2020-06-30 21:56:19 +02:00
Eduardo Broto
814349f941 Lint enabling the whole restriction group 2020-06-30 21:56:19 +02:00
flip1995
1e861a2663
Merge remote-tracking branch 'upstream/master' into rustup2 2020-06-30 15:40:22 +02:00
Dylan MacKenzie
3c5ee3300f Update tests 2020-06-28 10:08:12 -07:00
bors
46d33043d5 Auto merge of #5701 - ebroto:4874_cmp_owned_fp, r=flip1995
cmp_owned: handle when PartialEq is not implemented symmetrically

changelog: Handle asymmetrical implementations of PartialEq in [`cmp_owned`].

Fixes #4874
2020-06-24 12:48:24 +00:00
bors
a14eab389f Auto merge of #5745 - montrivo:copy_on_clone, r=phansch
clone_on_copy - add machine applicability

Fix #4826.
Change the applicability of the lint clone_on_copy. Split a test file and run rustfix on the clone_on_copy part.

changelog: clone_on_copy - add machine applicability
2020-06-24 07:11:07 +00:00
Tim Nielens
6bf5434e19 copy_on_clone - add machine applicability 2020-06-24 01:01:44 +02:00
Eduardo Broto
b498e1d715 cmp_owned: reverse operands if necessary 2020-06-23 22:14:45 +02:00
Eduardo Broto
5987c7d404 cmp_owned: avoid FP when PartialEq is not implemented symmetrically 2020-06-23 22:14:45 +02:00
bors
583d644934 Auto merge of #5694 - wangtheo:issue-5626, r=matthiaskrgr
#5626: lint iterator.map(|x| x)

changelog: adds a new lint for iterator.map(|x| x) (see https://github.com/rust-lang/rust-clippy/issues/5626)

The code also lints for result.map(|x| x) and option.map(|x| x). Also, I'm not sure if I'm checking for type adjustments correctly and I can't think of an example where .map(|x| x) would apply type adjustments.
2020-06-23 15:59:27 +00:00
flip1995
80bcbf521c Merge commit 'c2c07fa9d095931eb5684a42942a7b573a0c5238' into clippyup 2020-06-23 17:05:22 +02:00
Philipp Krones
f562117788
Rollup merge of #5724 - ebroto:5697_const_result_option, r=Manishearth
redundant_pattern_matching: avoid non-`const fn` calls in const contexts

changelog: Avoid suggesting non-`const fn` calls in const contexts in [`redundant_pattern_matching`]

Fixes #5697
2020-06-23 14:39:49 +02:00
Philipp Krones
0799be7156
Rollup merge of #5712 - ijijn:master, r=flip1995
Remove `bar` from blacklisted names

changelog: Remove `bar` from blacklisted names
fixes #5225
2020-06-23 14:39:45 +02:00
Philipp Krones
9505919be5
Rollup merge of #5709 - ebroto:5389_ice, r=Manishearth
Fix ICE in consts::binop

changelog: Fix ICE in `consts::binop`

Fixes #5389
2020-06-23 14:39:43 +02:00
bors
c56c7e2d02 Auto merge of #5695 - esamudera:lint_mem_uninitialized, r=phansch,oli-obk
New lint: suggest `ptr::read` instead of `mem::replace(..., uninitialized())`

resolves: #5575

changelog: improvements to `MEM_REPLACE_WITH_UNINIT`:
- add a new test case in `tests/ui/repl_uninit.rs` to cover the case of replacing with `mem::MaybeUninit::uninit().assume_init()`.
- modify the existing `MEM_REPLACE_WITH_UNINIT` when replacing with `mem::uninitialized` to suggest using `ptr::read` instead.
- lint with `MEM_REPLACE_WITH_UNINIT` when replacing with `mem::MaybeUninit::uninit().assume_init()`
2020-06-23 05:14:21 +00:00
flip1995
018440c11e
Merge remote-tracking branch 'upstream/master' into rustup 2020-06-23 02:18:17 +02:00
Eduardo Broto
a7743e9084 redundant_pattern_matching: avoid non-const fn in const context 2020-06-17 00:32:47 +02:00
Ericko Samudera
8c1ee063bb mem_replace_with_uninit: suggest std::ptr::read 2020-06-17 01:26:37 +07:00
Iain Brandram-Adams
c020e45cd3 Update stderr to match, and reinforce comments 2020-06-14 12:40:36 +12:00
Teddy_Wang
40ee620e51 Added a lint for .map(|x| x) 2020-06-13 10:08:12 -04:00
Iain Brandram-Adams
f663a21c8f Remove bar from blacklisted names 2020-06-14 01:24:36 +12:00
Eduardo Broto
b21ef2b365 Fix ICE in consts::binop 2020-06-13 00:52:32 +02:00
Lzu Tao
c9bd35cac3 Migrate to numeric associated consts 2020-06-10 01:35:47 +00:00
Eduardo Broto
a083b84b78 if_same_then_else: don't assume multiplication is always commutative 2020-06-09 23:49:21 +02:00
Devin R
e521a4ed38 Add enough attrs to the test file so the fix compiles with no errors, fmt/clippy 2020-06-09 16:39:31 -04:00
Lzu Tao
8db24840f7 Merge commit 'ff0993c5e9162ddaea78e83d0f0161e68bd4ea73' into clippy 2020-06-09 14:36:01 +00:00
Devin R
288df59b25 Fix suggestion output, add run-rustfix to test file, stop sorting import segments duh 2020-06-08 16:00:33 -04:00
Devin R
8c5a5a92ec cleaned up import suggestion formatter, look into code reuse with wildcard impotrs 2020-06-08 16:00:33 -04:00
Devin R
d4f60b5ff4 wip: of handling nested import paths for multi-macro paths 2020-06-08 16:00:33 -04:00
Devin R
8bc106b29d fix some of the review, rename, fmt, refactor 2020-06-08 16:00:33 -04:00
Devin R
8ffbf6f94d use hashset not map for keeping track of seen macro refs
remove stdout, fix clippy warnings, fmtcar
2020-06-08 16:00:33 -04:00
Devin R
ede366be63 collected all the imports and names
how to compare macro to import path

add more imports to test
2020-06-08 16:00:30 -04:00
Devin R
a4b8bb88f2 warn on macro_use attr
cargo dev update lints

use if_chain

clean up alot, span_lint_and_sugg

find imported macros for sugg
2020-06-08 15:59:41 -04:00
bors
ff0993c5e9 Auto merge of #5692 - ebroto:5689_N_dotdot_N, r=yaahc
reversed_empty_ranges: avoid linting N..N except in for loop arguments

changelog: [`reversed_empty_ranges`]: avoid linting N..N except in for loop arguments

r? @yaahc
Fixes #5689
2020-06-08 17:15:45 +00:00
bors
f947644f0d Auto merge of #5680 - ebroto:3792_let_return, r=Manishearth
let_and_return: avoid "does not live long enough" errors

EDIT: Add #3324 to the list of fixes

<details>
<summary>Description of old impl</summary>
<br>
Avoid suggesting turning the RHS expression of the last statement into the block tail expression if a temporary borrows from a local that would be destroyed before.

This is my first incursion into MIR so there's probably room for improvement!
</details>

Avoid linting if the return type of some method or function called in the last statement has a lifetime parameter.

changelog: Fix false positive in [`let_and_return`]

Fixes #3792
Fixes #3324
2020-06-08 16:47:22 +00:00
Mazdak Farrokhzad
d6136b92a2
split unnested_or_patterns test 2020-06-07 21:16:05 +02:00
Mazdak Farrokhzad
7b6dc7b33d
add unnested_or_patterns lint 2020-06-07 21:09:47 +02:00
Eduardo Broto
ebfc1da07d reversed_empty_ranges: don't lint N..N except in for loop arg 2020-06-07 21:03:08 +02:00
Eduardo Broto
dac8a3c1ca let_and_return: do not lint if last statement borrows 2020-06-07 20:53:38 +02:00
Eduardo Broto
9c205d7b1b Rename let_and_return test for consistency with the lint name 2020-06-07 20:53:38 +02:00
flip1995
5bdbc45ae5
Rustup to rust-lang/rust#71796 2020-06-07 03:07:48 +02:00
Lzu Tao
b39fd5f62f Fix false negative of checked_conversion lint 2020-06-03 09:04:24 +07:00
bors
153ef1c76f Auto merge of #5672 - phansch:regression-test-env, r=yaahc
Add regression test for `string_lit_as_bytes` issue

Closes #5619

Before the fix in https://github.com/rust-lang/rust/pull/72637, `string_lit_as_bytes` was incorrectly triggering on the `env!` macro. With the fix merged, this test makes sure that the lint is not triggering anymore.

changelog: none
2020-06-02 12:40:20 +00:00
bors
f760d77bdb Auto merge of #5597 - esamudera:slice_iter_next, r=flip1995
New lint: iter_next_slice

Hello, this is a work-in-progress PR for issue: https://github.com/rust-lang/rust-clippy/issues/5572

I have implemented lint to replace `iter().next()` for `slice[index..]` and `array` with `get(index)` and `get(0)` respectively. However since I made a lot of changes, I would like to request some feedback before continuing so that I could fix mistakes.

Thank you!

---

changelog: implement `iter_next_slice` lint and test, and modify `needless_continues`, `for_loop_over_options_result` UI tests since they have `iter().next()`
2020-06-02 11:42:22 +00:00
bors
bfafb8e0d6 Auto merge of #5673 - phansch:endless-loop, r=Manishearth
Add regression test for endless loop / update `pulldown_cmark`

Closes #4917

This was fixed in pulldown_cmark 0.7.1, specifically raphlinus/pulldown-cmark#438

changelog: none
2020-06-01 17:16:06 +00:00
Philipp Hansch
861b897c54
Add regression test for endless loop
This was fixed in pulldown_cmark 0.7.1, specifically
https://github.com/raphlinus/pulldown-cmark/pull/438
2020-06-01 10:20:17 +02:00
Philipp Hansch
ae0ce2255a
Add regression test for string_lit_as_bytes issue 2020-06-01 09:58:42 +02:00
JarredAllen
9a5baed482 Implement suggestions from phansch 2020-05-31 15:09:12 -07:00
Ericko Samudera
32fde0b511 New lint: iter_next_slice 2020-06-01 03:08:51 +07:00
JarredAllen
20cb512e81 Updated test cases and formatted 2020-05-31 12:06:32 -07:00
JarredAllen
015ab9f925 Renamed to 2020-05-31 11:55:45 -07:00
JarredAllen
07886a9764 Detect also when works 2020-05-31 11:55:45 -07:00
JarredAllen
059e8edd15 Detect also a non-reversed comparison 2020-05-31 11:55:45 -07:00
JarredAllen
955a25ee7d Added negative test cases and ran cargo dev fmt 2020-05-31 11:55:45 -07:00
JarredAllen
943cb94dce Passes all tests now! 2020-05-31 11:55:45 -07:00
JarredAllen
8590ab4d46 More progress towards sort_by_key_reverse lint 2020-05-31 11:55:45 -07:00
JarredAllen
24847ea53e Attempted start at sort_by_key_reverse lint 2020-05-31 11:55:45 -07:00
JarredAllen
7e843515d9 Created lint 2020-05-31 11:55:45 -07:00
flip1995
77dd0ea62a
Add tests for empty blocks 2020-05-31 19:29:36 +02:00
flip1995
6d15a14964
Update test files 2020-05-31 18:50:33 +02:00
flip1995
380d941a04
Adapt stderr and fixed files 2020-05-31 18:48:28 +02:00
Philipp Krones
00c656d8ee
Rollup merge of #5663 - matthiaskrgr:crash_test_3969, r=Manishearth
add testcase that no longer ICEs

Fixes #3969

changelog: none
2020-05-31 14:57:34 +02:00
Philipp Krones
873c9fc8f2
Rollup merge of #5656 - ebroto:len_zero_ranges, r=matthiaskrgr
len_zero: skip ranges if feature `range_is_empty` is not enabled

If the feature is not enabled, calling `is_empty()` on a range is ambiguous. Moreover, the two possible resolutions are unstable methods, one inherent to the range and the other being part of the `ExactSizeIterator` trait.

Since `len_zero` only checks for existing `is_empty()` inherent methods, we only take into account the `range_is_empty` feature.

Related: https://github.com/rust-lang/rust/issues/48111#issuecomment-445132965

changelog: len_zero: avoid linting ranges without #![feature(range_is_empty)]

Fixes: #3807
2020-05-31 14:57:33 +02:00
Tim Nielens
5faab874f9 new lint: vec_resize_to_zero 2020-05-30 17:52:10 +02:00
Matthias Krüger
b92cc8a08d add testcase that no longer ICEs
Fixes #3969
2020-05-29 22:52:24 +02:00
flip1995
a0e9f9bd0d Merge commit '7ea7cd165ad6705603852771bf82cc2fd6560db5' into clippyup2 2020-05-28 15:45:24 +02:00
Eduardo Broto
64a05f56c3 len_zero: skip ranges if feature range_is_empty is not enabled 2020-05-28 00:58:48 +02:00
bors
ee3088f27b Auto merge of #5631 - ThibsG:ExtendUselessConversion, r=matthiaskrgr
Extend useless conversion

This PR extends `useless_conversion` lint with `TryFrom` and `TryInto`

fixes: #5344

changelog: Extend `useless_conversion` with `TryFrom` and `TryInto`
2020-05-27 13:06:59 +00:00
Matthias Krüger
3089c3b307 rustup https://github.com/rust-lang/rust/pull/72342, allow unused_crate_dependencies 2020-05-27 13:57:48 +02:00
ThibsG
1801841ae5 Add test cases for broader coverage 2020-05-26 18:43:12 +02:00
bors
291385b3e0 Auto merge of #5609 - phansch:empty-line-after-outer-attr-fix, r=flip1995
Make empty_line_after_outer_attr an early lint

Fixes #5567

Unfortunately I couldn't find a way to reproduce the issue without syn/quote. Considering that most real-world macros use syn and/or quote, I think it's okay to pull them in anyway.

changelog: Fix false positive in [`empty_line_after_outer_attr`]
2020-05-26 15:10:35 +00:00
Philipp Hansch
67167be167
Make empty_line_after_outer_attr an early lint 2020-05-26 16:52:02 +02:00
bors
a00025ab21 Auto merge of #5638 - ebroto:issue_5628_add_suggestion_for_reversed_empty_ranges, r=phansch
reversed_empty_ranges: add suggestion for &slice[N..N]

As discussed in the issue thread, the user accepted this solution. Let me know if this is what we want, or if changing the way we lint the N..N case is prefered.

changelog: reversed_empty_ranges: add suggestion for &slice[N..N]

Closes #5628
2020-05-26 11:56:16 +00:00
bors
2a6cfa7f05 Auto merge of #5647 - ebroto:5644_allow_ptr_arg_in_arg_position, r=flip1995
ptr_arg: honor `allow` attribute on arguments

The `intravisit::Visitor` impl for `LateContextAndPass` only takes into account the attributes of a function parameter inside the `check_param` method. `ptr_arg` starts its heuristics at `check_item` / `check_impl_item` / `check_trait_item`, so the `allow` is not taken into account automatically.

changelog: ptr_arg: honor `allow` attribute on arguments

Fixes #5644
2020-05-25 21:47:07 +00:00
Eduardo Broto
a1824e187c ptr_arg: honor allow attr on arguments 2020-05-25 23:09:06 +02:00
Jeremy Stucki
d9f55322cc
Update ui test 2020-05-25 21:41:28 +02:00
Jeremy Stucki
6bd9cd99a3
Add tests 2020-05-25 21:41:19 +02:00
bors
6de17b043d Auto merge of #5635 - montrivo:bugfix/option_option_test_case, r=flip1995
option_option test case #4298

Adds regression test case for #4298.

The bug seems still present although rust Playground said otherwise.

changelog: none
2020-05-25 19:22:08 +00:00
Eduardo Broto
60d38ee1dd reversed_empty_ranges: add suggestion for &slice[N..N] 2020-05-25 20:06:15 +02:00
ThibsG
705bfdcc46 Extend useless_conversion lint with TryInto 2020-05-25 20:00:39 +02:00
ThibsG
4f8909fad9 Extend useless_conversion lint with TryFrom 2020-05-25 20:00:39 +02:00
bors
c41916d9bd Auto merge of #5616 - euclio:no-derive-suggestion, r=phansch,flip1995
new_without_default: do not suggest deriving

---

changelog: do not suggest deriving `Default` in `new_without_default`

This commit changes the behavior of the `new_without_default` lint to not suggest deriving `Default`. This suggestion is misleading if the `new` implementation does something different than what a derived `Default` implementation would do, because then the two methods would not be equivalent.

Instead, the `can_derive_default` check is removed, and we always suggest implementing `Default` in terms of `new()`.
2020-05-25 17:19:00 +00:00
Tim Nielens
29d043683e option_option test case #4298 2020-05-22 19:21:30 +02:00
Andy Russell
a578bed69a
new_without_default: do not suggest deriving 2020-05-22 11:49:51 -04:00
Elichai Turkel
2db7f1abf8
Update future-not-send stderr output 2020-05-20 16:46:30 +03:00
Elichai Turkel
ecd0a67b01
Make match_wild_err_arm pedantic, and update help messages 2020-05-20 16:39:03 +03:00
bors
cafa94662c Auto merge of #5582 - vtmargaryan:match_wildcard_for_single_variants, r=flip1995
New lint: `match_wildcard_for_single_variants`

changelog: Added a new lint match_wildcard_for_single_variants to warn on enum matches where a wildcard is used to match a single variant

Closes #5556
2020-05-20 12:51:28 +00:00
flip1995
da9b138ec7
Update test after const_ptr functions are must_use now 2020-05-20 13:25:20 +02:00
bors
8164832c4b Auto merge of #68717 - petrochenkov:stabexpat, r=varkor
Stabilize fn-like proc macros in expression, pattern and statement positions

I.e. all the positions in which stable `macro_rules` macros are supported.

Depends on https://github.com/rust-lang/rust/pull/68716 ("Stabilize `Span::mixed_site`").

cc https://github.com/rust-lang/rust/issues/54727
cc https://github.com/rust-lang/rust/issues/54727#issuecomment-580647446

Stabilization report: https://github.com/rust-lang/rust/pull/68717#issuecomment-623197503.
2020-05-19 03:11:32 +00:00