Commit Graph

451 Commits

Author SHA1 Message Date
CrazyRoka
96e2bc80f5 Added lint match_vec_item 2020-04-24 22:45:15 +03:00
Andy Weiss
6c25c3c381 Lint for holding locks across await points
Fixes #4226

This introduces the lint await_holding_lock. For async functions, we iterate
over all types in generator_interior_types and look for types named MutexGuard,
RwLockReadGuard, or RwLockWriteGuard. If we find one then we emit a lint.
2020-04-21 21:07:43 -07:00
bors
6ce05bf849 Auto merge of #5332 - DevinR528:if-let-else-mutex, r=flip1995
If let else mutex

changelog: Adds lint to catch incorrect use of `Mutex::lock` in `if let` expressions with lock calls in any of the blocks.

closes: #5219
2020-04-20 20:21:33 +00:00
Devin R
001a42e632 progress work on suggestion for auto fix 2020-04-20 06:29:59 -04:00
Eduardo Broto
00b4f2819f Implement unsafe_derive_deserialize lint 2020-04-19 23:26:17 +02:00
pmk21
7c52e51d79 Added basic lint and tests 2020-04-18 11:39:54 +05:30
Roland Kuhn
d2cbbff217 add lint futures_not_send 2020-04-17 13:54:05 +02:00
Philipp Krones
ceea3c6a35
Rollup merge of #5248 - ThibsG:ConstValues, r=flip1995
Add lint on large non scalar const

This PR adds the new lint `non_scalar_const` that aims to warn against `const` declaration of large arrays. For performance, because of inlining, large arrays should be preferably declared as `static`.

Note: i made this one to warn on all const arrays, whether they are in a body function or not. I don't know if this is really necessary, i could just reduce this lint to variables out of function scope.

Fixes: #400

changelog: add new lint for large non-scalar types declared as const
2020-04-15 20:12:28 +02:00
ThibsG
72b9ae2a10 Use only check_expr with parent expr and precedence 2020-04-15 17:18:12 +02:00
ThibsG
6b4ab82746 Global rework + fix imports 2020-04-15 17:18:12 +02:00
ThibsG
380f7218b3 Add lint on large const arrays 2020-04-09 09:09:39 +02:00
Nick Torres
91d8a804d3 result_map_or_into_option: add lint to catch manually adpating Result -> Option
Result<T, E> has an `ok()` method that adapts a Result<T,E> into an Option<T>.
It's possible to get around this adapter by writing Result<T,E>.map_or(None, Some).

This lint is implemented as a new variant of the existing
[`option_map_none` lint](https://github.com/rust-lang/rust-clippy/pull/2128)
2020-04-04 03:17:13 -07:00
Jacek Pospychala
f8e892db5e useless Rc<Rc<T>>, Rc<Box<T>>, Rc<&T>, Box<&T> 2020-04-02 00:02:25 +02:00
Tomasz Miąsko
b77b219280 Lint unnamed address comparisons 2020-03-30 21:42:16 +02:00
bors
d3989eef2d Auto merge of #5319 - 1tgr:master, r=flip1995
Lint for `pub(crate)` items that are not crate visible due to the visibility of the module that contains them

changelog: Add `redundant_pub_crate` lint

Closes #5274.
2020-03-23 20:35:49 +00:00
flip1995
552768f092
Update changelog to 1.43.0 beta 2020-03-18 14:55:44 +01:00
Tim Robinson
52208f3cf3 Lint for pub(crate) items that are not crate visible due to the visibility of the module that contains them
Closes #5274.
2020-03-16 12:21:00 +00:00
flip1995
7b08c7a36e
Change changelog formatting 2020-03-12 21:02:15 +01:00
flip1995
da29402d2e
Update CHANGELOG.md 2020-03-12 21:01:19 +01:00
Jacob Meyers
0f7f30711e add lint on File::read_to_string and File::read_to_end 2020-03-06 09:50:49 -05:00
flip1995
57393b5106
Rename macro_use_import -> macro_use_imports 2020-03-05 19:22:17 +01:00
Devin R
597e02dcdf warn on macro_use attr 2020-03-04 09:36:02 -05:00
ThibsG
2aa14c9beb Add restrictive pat use in full binded struct 2020-03-04 09:11:07 +01:00
Krishna Sai Veera Reddy
ff0d44e45a Add imprecise_flops lint
Add lint to detect floating point operations that can be computed more
accurately at the cost of performance. `cbrt`, `ln_1p` and `exp_m1`
library functions call their equivalent cmath implementations which is
slower but more accurate so moving checks for these under this new lint.
2020-02-23 22:36:15 -08:00
Krishna Sai Veera Reddy
4065ca9c8c Move manual_mul_add into suboptimal_flops lint 2020-02-23 22:20:34 -08:00
Krishna Sai Veera Reddy
6dacb1aa67 Change lint name to suboptimal_flops 2020-02-23 22:20:34 -08:00
Krishna Veera Reddy
1f4f357bf5 Consolidate the accuracy and efficiency lints
Merge the accuracy and efficiency lints into a single lint that
checks for improvements to accuracy, efficiency and readability
of floating-point expressions.
2020-02-23 22:20:33 -08:00
Krishna Veera Reddy
c636c6a55b Add lints to detect inaccurate and inefficient FP operations
Add lints to detect floating point computations that are either
inaccurate or inefficient and suggest better alternatives.
2020-02-23 22:20:33 -08:00
flip1995
4229dbcf33
Run update_lints 2020-02-21 11:14:16 +01:00
Krishna Sai Veera Reddy
219c94d028 Separate out lint to check lossy whole number float literals 2020-02-20 22:33:36 -08:00
flip1995
757bbf7feb
Fix markdown Files
Rendered:

[CHANGELOG.md](https://github.com/flip1995/rust-clippy/blob/gha/CHANGELOG.md)
[CODE_OF_CONDUCT.md](https://github.com/flip1995/rust-clippy/blob/gha/CODE_OF_CONDUCT.md)
[CONTRIBUTING.md](https://github.com/flip1995/rust-clippy/blob/gha/CONTRIBUTING.md)
[README.md](https://github.com/flip1995/rust-clippy/blob/gha/README.md)
[clippy_dummy/PUBLISH.md](https://github.com/flip1995/rust-clippy/blob/gha/clippy_dummy/PUBLISH.md)
[doc/adding_lints.md](https://github.com/flip1995/rust-clippy/blob/gha/doc/adding_lints.md)
[etc/relicense/RELICENSE_DOCUMENTATION.md](https://github.com/flip1995/rust-clippy/blob/gha/etc/relicense/RELICENSE_DOCUMENTATION.md)
2020-02-12 09:34:25 +01:00
Krishna Sai Veera Reddy
be1bc571c3 Add option-env-unwrap lint 2020-02-08 16:44:35 -08:00
Areredify
338fb7a3e9 add excessive bools lints 2020-02-05 20:54:58 +03:00
ThibsG
6afd7ea147 Use span_lint_and_sugg + move infaillible lint
- moving infaillible lint to prevent collisions
2020-02-04 22:49:08 +01:00
flip1995
1ef4509eb4
Update changelog 2020-01-30 23:34:07 +01:00
Mikhail Babenko
d1f8621711 add lint 2020-01-30 16:48:56 +03:00
xiongmao86
512efbea23 Declare lint and implement lint logic. 2020-01-30 00:21:29 +08:00
Areredify
796958c7e2 add option_as_ref_deref lint 2020-01-23 16:12:16 +03:00
Yuki Okushi
95c369fa91 Add skip_while_next lint 2020-01-20 10:56:02 +09:00
xiongmao86
96334d0d7c Declare lint. 2020-01-12 19:54:17 +08:00
ThibsG
8ae8b08e32 Change lint name to WILDCARD_IN_OR_PATTERNS 2020-01-07 18:48:16 +01:00
ThibsG
96c4198832 New lint: pats_with_wild_match_arm
- Wildcard use with other pattern in same match arm
2020-01-07 18:48:16 +01:00
Krishna Sai Veera Reddy
9e6a6069a7 Add lint to detect usage of invalid atomic ordering
Detect usage of invalid atomic ordering modes such as
`Ordering::{Release, AcqRel}` in atomic loads and
`Ordering::{Acquire, AcqRel}` in atomic stores.
2020-01-06 16:39:31 -08:00
Brad Sherman
ab5ff0352e Add lint for iter.nth(0)
- Encourage iter.next() rather than iter.nth(0), which is less readable
2020-01-04 11:20:11 -06:00
Krishna Veera Reddy
8db319f957 Use mem::take instead of mem::replace when applicable
`std::mem::take` can be used to replace a value of type `T`
with `T::default()` instead of `std::mem::replace`.
2019-12-31 09:22:34 -08:00
mgr-inz-rafal
f191e916bd Add new lint (modulo_arithmetic) 2019-12-28 16:46:08 +01:00
bors
1837cbce6c Auto merge of #4885 - rust-lang:mut-key-types, r=flip1995
new lint: mutable_key_type

This fixes #732 - well, partly, it doesn't adress `Hash` impls, but the use of mutable types as map keys or set members

changelog: add `mutable_key_type` lint

r? @flip1995
2019-12-24 13:32:45 +00:00
Andre Bogus
40435acf3d new lint: mutable_key_type 2019-12-24 13:46:19 +01:00
bors
143ad5e2d1 Auto merge of #4911 - phansch:update_changelog, r=flip1995
Update changelog for Rust 1.39 and 1.40

[Rendered](https://github.com/phansch/rust-clippy/blob/update_changelog/CHANGELOG.md)

changelog: none
2019-12-23 16:06:56 +00:00
Philipp Hansch
b1a5d25221
Fix two commit hashes in changelog 2019-12-23 07:08:09 +01:00