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
Mikhail Babenko
a310cb2d0b
implemented let_underscore
lint
...
actually add files
update lints
change to pedantic
2019-12-22 22:10:25 +03:00
Philipp Hansch
123ecac655
Update changelog for Rust 1.39 and 1.40
2019-12-18 21:28:52 +01:00
Krishna Veera Reddy
c77fc06d52
Add lint to detect transmutes from float to integer
...
Add lint that detects transmutation from a float to an integer
and suggests usage of `{f32, f64}.to_bits()` instead.
2019-12-07 16:33:49 -08:00
RobbieClarken
f5d0a452ba
Add lint for pub fns returning a Result
without documenting errors
...
The Rust Book recommends that functions that return a `Result` type have
a doc comment with an `# Errors` section describing the kind of errors
that can be returned
(https://doc.rust-lang.org/book/ch14-02-publishing-to-crates-io.html#commonly-used-sections ).
This change adds a lint to enforce this. The lint is allow by default;
it can be enabled with `#![warn(clippy::missing_errors_doc)]`.
Closes #4854 .
2019-12-06 17:19:05 +10:30
Mikhail Babenko
9ec8888b91
implemented as_conversions
lint
...
actuall add files
add better example and change pedantic to restriction
2019-11-25 18:12:52 +03: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
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
Andre Bogus
c21b198576
New lint: zst_offset
2019-11-15 22:39:27 +01:00