Commit graph

3822 commits

Author SHA1 Message Date
flip1995
a9cde3a804
Don't suggest to move empty blocks 2020-05-31 19:29:03 +02:00
flip1995
4c9cefa122
Move linting out in its own function 2020-05-31 18:50:33 +02:00
flip1995
f9c325f5b6
Suggest to remove the semicolon of the last stmt in a block 2020-05-31 18:50:33 +02:00
flip1995
0f69cafc2d
Rework suggestion generation and use multipart_suggestion again 2020-05-31 18:50:31 +02:00
flip1995
a1a1a4b82a
Use multiple span_suggestions instead of multipart_suggestion
multipart suggestions aren't autofixable by rustfix yet
2020-05-31 18:48:29 +02:00
flip1995
0ab823c509
Rework suggestion generation of unit_arg lint 2020-05-31 18:47:48 +02:00
bors
8aa8f42556 Auto merge of #5667 - djugei:master, r=flip1995
moved cast_ptr_alignment to pedantic and expanded documentation

fixes: #5618
changelog: cast_ptr_alignment moved to pedantic
2020-05-31 14:26:03 +00:00
djugei
18b5ceed79
ran update_lints 2020-05-31 16:00:29 +02:00
djugei
0bcfae92f8
moved cast_ptr_alignment to pedantic and expanded documentation 2020-05-31 15:41:33 +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
Philipp Krones
0fff522071
Rollup merge of #5637 - montrivo:feature/vec_resize_to_zero, r=yaahc,flip1995
new lint: vec_resize_to_zero

implements #5444

changelog: new lint vec_resize_to_zero
2020-05-31 14:57:32 +02:00
flip1995
37381d33a4
Fix sync fallout 2020-05-31 14:05:57 +02:00
Tim Nielens
5faab874f9 new lint: vec_resize_to_zero 2020-05-30 17:52:10 +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
Eduardo Broto
4161823475 Avoid triggering similar names on code from expansion 2020-05-27 00:06:50 +02:00
flip1995
04db13eb56 Fix fallout in similar_names 2020-05-26 21:41:51 +02:00
flip1995
8e22d15055 Fix fallout in redundant_field_names 2020-05-26 21:41:51 +02:00
flip1995
7fd3bd0f57 Register redundant_field_names and non_expressive_names as early passes 2020-05-26 21:41:51 +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
182ac89f16 Auto merge of #5636 - ebroto:issue_5041, r=phansch
multiple_crate_versions: skip dev and build deps

changelog: multiple_crate_versions: skip dev and build deps

Closes #5041
2020-05-26 06:23:58 +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
bcfeb4de15
Fix build 2020-05-25 21:41:20 +02:00
Jeremy Stucki
566377f627
Ignore calls to 'len' 2020-05-25 21:41:20 +02: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
Eduardo Broto
ec0a00e539 Use find_map instead of find() + map() 2020-05-25 20:00:08 +02:00
Eduardo Broto
8642fc97dd multiple_crate_versions: skip dev and build deps 2020-05-25 20:00:08 +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
bors
7ca335a97d Auto merge of #5639 - nickrtorres:unnecessary-mut-passed-doc-cleanup, r=phansch
Clarify the documentation of the `unnecessary_mut_passed` lint

fixes #5433 by replacing "giving" with "passing"

changelog: Clarifies documentation for `unnecessary_mut_passed`
2020-05-25 17:02:12 +00:00
bors
f162dc3ea0 Auto merge of #5646 - flip1995:rustup, r=matthiaskrgr
Rustup

r? @phansch

changelog: none
2020-05-25 16:42:50 +00:00
Nick Torres
a709559705 Clarify the documentation of the unnecessary_mut_passed lint 2020-05-23 16:15:30 -07:00
Bastian Kauschke
e820a03d1c iterate List by value 2020-05-23 12:24:19 +02:00
Dylan MacKenzie
b3a690f5a1 Use OnceCell instead of Once 2020-05-22 13:31:02 -07:00
Andy Russell
a578bed69a
new_without_default: do not suggest deriving 2020-05-22 11:49:51 -04:00
bors
ce86f907ef Auto merge of #5632 - flip1995:rustup, r=phansch
Rustup

changelog: none
2020-05-22 13:00:38 +00:00
flip1995
6b3cf63bf5
Fix dogfood fallout 2020-05-22 14:45:51 +02:00
Eduardo Broto
7a0eccbd8a Add test for multiple_crate_versions
Make the output of the lint deterministic by sorting the versions
2020-05-21 14:11:11 +02:00
Eduardo Broto
bc93f7052e Add test for cargo_common_metadata
Fix missing `authors` entry in the provided example
2020-05-21 14:11:11 +02:00
bors
1831385ff0 Auto merge of #5611 - rrbutani:master, r=flip1995
Add to the list of words clippy::doc_markdown ignores

"TypeScript" is the only one of these I actually ran into organically; I can remove the others if they're too much.

changelog: Add to the list of words `clippy::doc_markdown` ignores
2020-05-20 14:15:12 +00:00
Bastian Kauschke
091239ee60 introduce newtype'd Predicate<'tcx> 2020-05-20 15:44:34 +02:00
Elichai Turkel
ecd0a67b01
Make match_wild_err_arm pedantic, and update help messages 2020-05-20 16:39:03 +03:00
Bastian Kauschke
2722522fac rename Predicate to PredicateKind, introduce alias 2020-05-20 15:38:03 +02: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