Commit graph

3433 commits

Author SHA1 Message Date
Takayuki Nakata f98ffa271d Fix FP for same_item_push
Don't emit a lint when `pushed_item` was declared as mutable variable.
2020-08-14 22:54:12 +09:00
bors 439bae62a4 Auto merge of #5884 - Ryan1729:patch-1, r=flip1995
Add the other overloadable operations to suspicious_arithmetic_impl

In #2268 I idly mused that the other user-overloadable operations could be added to this lint. Knowing that the lint was arguably incomplete was gnawing at the back of my mind, so I figured that I might as well make this PR, particularly given the change needed was so small.

changelog: Start warning on suspicious implementations of the `BitAnd`, `BitOr`, `BitXor`, `Rem`, `Shl`, and `Shr` traits.
2020-08-12 17:00:48 +00:00
Ryan1729 7bd7a46331 run tests/ui/update-references.sh to update 'suspicious_arithmetic_impl.rs' 2020-08-12 10:52:20 -06:00
Ryan1729 f4eeff99b6 add tests for Rem, BitAnd, BitOr, BitXor, Shl, and Shr 2020-08-12 10:33:16 -06:00
Matthias Krüger be3e695b60 if_not_else: make lint adhere to lint message convention 2020-08-11 16:43:53 +02:00
Matthias Krüger 605e027fda if_let_some_result: make lint adhere to lint message convention 2020-08-11 16:40:45 +02:00
Matthias Krüger 89591a78b8 enum-variant-names: make lint adhere to lint message convention 2020-08-11 16:38:20 +02:00
Matthias Krüger db390f5e6a enum-clike-unportable-variant: tweak message a bit (Clike -> C-like) 2020-08-11 16:35:09 +02:00
Matthias Krüger 2de290d5c5 duration-subsec: make lint adhere to lint message convention 2020-08-11 16:31:02 +02:00
Matthias Krüger 423615693b pub-enum-variant-names: make lint adhere to lint message convention 2020-08-11 16:28:05 +02:00
Matthias Krüger 1f17c3b02b multiple_inherent_impl: make lint adhere to lint message convention 2020-08-11 15:28:51 +02:00
Matthias Krüger bdf4dc3abd implicit-saturating-sub: make lint adhere to lint message convention 2020-08-11 15:22:59 +02:00
Matthias Krüger f171f89aed int_plus_one: make lint adhere to lint message convention 2020-08-11 15:15:26 +02:00
Matthias Krüger 6af297f80e iter-next-slice: make lint adhere to lint message convention 2020-08-11 15:15:26 +02:00
Matthias Krüger 04867e004e mutex-atomic: make lint adhere to lint message convention 2020-08-11 15:15:26 +02:00
Matthias Krüger ac194cafc1 map_clone: make lint adhere to lint message convention 2020-08-11 15:15:26 +02:00
Matthias Krüger c0a9d64818 stable-sort-primitive: make lint adhere to lint message convention 2020-08-11 15:15:26 +02:00
bors 3337f7956c Auto merge of #5892 - matthiaskrgr:redundant_mut, r=flip1995
unnecessary-mut-passed: make lint message say if fn is a function or a method

changelog: refine "unnecessary-mut-passed" lint message
2020-08-11 12:52:41 +00:00
bors 09bd400243 Auto merge of #5891 - flip1995:rustup, r=flip1995
Rustup

r? @ghost

Sync back rust-lang/rust#75098

changelog: none
2020-08-11 12:32:10 +00:00
flip1995 9311c11d7c
Fix sync fallout 2020-08-11 14:21:27 +02:00
Matthias Krüger b8713e3854 unnecessary-mut-passed: make lint message say if fn is a function or a method. 2020-08-11 14:16:56 +02:00
Dylan DPC 9e73d33680 Rollup merge of #75098 - Ryan1729:clippy-pointer-cast-lint-experiment, r=oli-obk
Clippy pointer cast lint experiment

This PR is an experiment about exposing more parts of `rustc_typeck` for use in `clippy`. In particular, the code that checks where a cast is valid or not was exposed, which necessitated exposing [`FnCtxt`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_typeck/check/struct.FnCtxt.html), and figuring out how to create an instance of that type inside `clippy`.

This was prompted by [this clippy issue](https://github.com/rust-lang/rust-clippy/issues/2064).

r? @oli-obk
2020-08-11 01:56:30 +02:00
bors cc5bfd473c Auto merge of #5888 - matthiaskrgr:lints, r=yaahc
make a bunch of lints texts adhere to rustc dev guide

According to the rustc-dev guide: "The text should be matter of fact and avoid capitalization and periods, unless multiple sentences are needed"

changelog: make some lint output adhere to the rustc-dev guide
2020-08-10 22:40:42 +00:00
Matthias Krüger 6d0b5e24df update test stderr 2020-08-11 00:27:55 +02:00
Matthias Krüger dabf989195 neg-cmp-op-on-partial-ord: make lint adhere to lint message convention 2020-08-10 23:49:06 +02:00
Matthias Krüger 178da9b2ef neg-multiply: make lint adhere to lint message convention 2020-08-10 23:49:06 +02:00
Matthias Krüger e519bb3c85 overflow-check-conditional: make lint adhere to lint message convention 2020-08-10 23:49:06 +02:00
Matthias Krüger 9178363574 path-buf-push-overwrite: make lint adhere to lint message convention 2020-08-10 23:49:06 +02:00
Matthias Krüger 81f77a411e range-zip-with-len: make lint adhere to lint message convention 2020-08-10 23:49:06 +02:00
Matthias Krüger 3e1e0c9bdb redundant-static-lifetimes: make lint adhere to lint message convention 2020-08-10 23:49:06 +02:00
Matthias Krüger 5d69ca5e11 also change "deprecated-attribute" message 2020-08-10 23:49:06 +02:00
Matthias Krüger fe37ddbd11 suspicious-arithmetic-impl: make lint adhere to lint message convention 2020-08-10 23:49:06 +02:00
Matthias Krüger 7954c22a99 unknown: make lint adhere to lint message convention 2020-08-10 23:49:06 +02:00
Matthias Krüger b36a6c9594 ref_in_deref: make lint adhere to lint message convention 2020-08-10 23:49:06 +02:00
Matthias Krüger 4418ff122f unneeded-field-pattern: make lint adhere to lint message convention 2020-08-10 23:49:06 +02:00
Matthias Krüger 2792260636 empty-liner-after-outer-attr: make lint adhere to lint message convention 2020-08-10 23:49:06 +02:00
Matthias Krüger 0db5cb1393 drop_bounds: make lint adhere to lint message convention 2020-08-10 23:49:06 +02:00
Matthias Krüger 590b91d8d4 double-parens: make lint adhere to lint message convention and do minor refactoring 2020-08-10 23:49:06 +02:00
Matthias Krüger ba7a01a6a8 double-comparisons: make lint adhere to lint message convention 2020-08-10 23:49:06 +02:00
Matthias Krüger 6b0a6a70f8 default-trait-access: make lint adhere to lint message convention 2020-08-10 23:49:06 +02:00
Matthias Krüger 3d592b5154 cmp_null: make lint adhere to lint message convention 2020-08-10 23:49:06 +02:00
Matthias Krüger 8679dd375b unnecessary_unwrap, panicking_unwrap: make lints adhere to lint message convention 2020-08-10 23:49:06 +02:00
Matthias Krüger 9b7ab1d38b checked-conversions: make lint adhere to lint message convention 2020-08-10 23:48:57 +02:00
Eduardo Broto 5d66bd7bb3 Avoid or_fun_call for const_fn with no args 2020-08-10 23:38:58 +02:00
Matthias Krüger 40416c0fa8 naive_bytecount: make lint adhere to lint message convention 2020-08-10 20:55:23 +02:00
Matthias Krüger fd379a889e builtin-type-shadow: make lint adhere to lint message convention 2020-08-10 20:55:23 +02:00
Matthias Krüger 0876f17d77 bool-comparison: make lint adhere to lint message convention 2020-08-10 20:55:23 +02:00
Matthias Krüger e57aafe33f too-many-lines: make lint adhere to lint message convention 2020-08-10 20:55:23 +02:00
Philipp Krones ee8db50e13
Rollup merge of #5871 - wiomoc:feature/methodcall-minmax, r=flip1995
Lint .min(x).max(y) with x < y

Fixes  #5854

changelog: Also lint `ord.min(a).max(b)`, where `a < b` in [`min_max`] lint
2020-08-10 14:56:29 +02:00
Philipp Krones 08ab29bed1
Rollup merge of #5870 - ebroto:5789_allow_unsafe_derive_deserialize, r=flip1995
enable #[allow(clippy::unsafe_derive_deserialize)]

Before this change this lint could not be allowed as the code we are checking is automatically generated.

changelog: Enable using the `allow` attribute on top of an ADT linted by [`unsafe_derive_deserialize`].

Fixes: #5789
2020-08-10 14:56:27 +02:00