Heinz N. Gies
abdf027df3
Update clippy_lints/src/lib.rs
...
Co-Authored-By: Philipp Krones <hello@philkrones.com>
2019-11-07 17:11:06 +01:00
Heinz N. Gies
a984702b50
Update clippy_lints/src/lib.rs
...
Co-Authored-By: Philipp Krones <hello@philkrones.com>
2019-11-07 17:11:05 +01:00
Heinz N. Gies
eae6a62db7
Simplify dentry point detection
2019-11-07 17:11:05 +01:00
Heinz N. Gies
ffcf4bec0f
Improve function checking
2019-11-07 17:10:18 +01:00
Heinz N. Gies
9471669e46
Exclude main from exit lint
2019-11-07 17:10:18 +01:00
Heinz N. Gies
60c2fdd0b9
Update lints
2019-11-07 17:10:18 +01:00
Heinz N. Gies
695aa59c6d
Add lint for exit
2019-11-07 17:10:18 +01:00
flip1995
08fd397c2c
Deprecate into_iter_on_array
lint
...
This lint was uplifted/reimplemented by rustc.
Rustup to rust-lang/rust#66017
2019-11-07 14:04:29 +01:00
flip1995
e917b01286
Rustup to rust-lang/rust#65884
2019-11-07 13:27:00 +01:00
Manish Goregaokar
305ba73fc1
Rustup to rustc 1.40.0-nightly (7a76fe76f 2019-11-07)
2019-11-07 13:14:40 +01:00
Michael Wright
e3c1aea157
use-self: correctly ignore dummy paths
2019-11-07 05:59:13 +02:00
flip1995
d3e88a58b9
Fix ICE #4775
2019-11-06 18:14:47 +01:00
bors
0be213bb79
Auto merge of #4772 - HMPerson1:tastier_ice_cream, r=flip1995
...
Use correct TypeckTables when hashing bodies
Fixes #4760
changelog: Fix ICE while hashing block expressions #4760
r? @phansch
2019-11-06 15:50:42 +00:00
Lzu Tao
42c8c03464
bump smallvec to 1.0.0
2019-11-06 17:46:45 +07:00
Lzu Tao
56f3ba33c5
chore: sort out clippy_lints deps
2019-11-06 17:46:45 +07:00
Lzu Tao
51632530d7
rustup rust-lang/rust#65776
2019-11-06 17:46:45 +07:00
Michael Wright
a952708b6c
Fix crash in use-self
lint
...
Fixes #4727
2019-11-06 07:33:56 +02:00
Lzu Tao
98313bd83a
chore: remove unnecessary parentheses around type
2019-11-05 22:05:55 +07:00
HMPerson1
e3d6069e18
Use correct TypeckTables when hashing bodies
2019-11-04 20:03:03 -05:00
Evan Stoll
8ca9c237a0
deprecated_lints: re-fix ASSIGN_OPS lint doc-comment
2019-11-02 14:19:25 -04:00
Evan Stoll
9a2c968f9f
deprecated_lints: align doc comment indents with pub LINT_NAME
2019-11-02 14:11:25 -04:00
Evan Stoll
1acea2e4fc
deprecated_lints: remove extraneous declare_deprecated_lint
2019-11-02 14:11:13 -04:00
Michael Wright
4e78547e6f
DecimalLiteralRepresentation
simplification
...
Remove recalculation of literal value.
2019-10-31 09:13:08 +02:00
Evan Stoll
94e35510ae
Fix #4748 - Deprecated lints don't expand
...
- Move doc comments inside of declare_deprecated_lint macros so that they are picked up by lintlib.py
2019-10-30 21:05:23 -04:00
Michael Wright
5ce8990885
Simplify approx const truncation check
2019-10-29 08:34:05 +02:00
Matthias Krüger
ece5f862c4
rustup https://github.com/rust-lang/rust/pull/65792/
2019-10-28 15:15:28 +01:00
flip1995
1e1d45a005
Move manual_mul_add into nursery
2019-10-26 19:57:01 +02:00
bors
bfef48f185
Auto merge of #4721 - phansch:fix_try_err_in_ext_macro, r=flip1995
...
Don't emit try_err lint in external macros
changelog: Fix [`try_err`] false positive in external macros
Closes #4709
2019-10-24 17:53:42 +00:00
flip1995
b2616641d9
Fix dogfood findings
2019-10-24 14:39:19 +02:00
flip1995
562cc63b7e
Fix lint_without_lint_pass lint
2019-10-24 13:54:18 +02:00
flip1995
237e168b89
Fix tests
2019-10-24 13:29:51 +02:00
flip1995
ef02e3a755
Run ./util/dev fmt
2019-10-24 11:55:22 +02:00
flip1995
5f4b5b91d7
Rustup to rust-lang/rust#65657
2019-10-24 11:54:11 +02:00
Mark Rousskov
7e77f3c29f
Update clippy for latest rustc changes
...
Specifically, this revises the clippy integration to utilize a new
callback to register its lints, as the prior editing of lint store in
Session is no longer possible.
2019-10-24 11:40:45 +02:00
Philipp Hansch
52f52900a4
Don't emit try_err lint in external macros
2019-10-24 07:52:01 +02:00
bors
850dfdae60
Auto merge of #4680 - hellow554:debug_assert_mut_call, r=flip1995
...
Add lint for debug_assert_with_mut_call
closes #1526
**What does not work:**
* detecting a mut call in the format string itself, e.g. `debug_assert!(false, "{}", vec![1].pop())`
* detecting `*mut T` usage (pointer)
---
changelog: add new lint `debug_assert_with_mut_call`
2019-10-23 20:58:14 +00:00
bors
087e5eaea5
Auto merge of #4691 - HMPerson1:suggest_iter, r=phansch
...
Fix suggestion of `explicit_counter_loop`
changelog: In the suggestion of `explicit_counter_loop`, if the `for` loop argument doesn't implement `Iterator`, then we suggest `x.into_iter().enumerate()` (or `x.iter{_mut}()` as appropriate). Also, the span of the suggestion has been corrected.
Fixes #4678
2019-10-23 20:12:14 +00:00
Matthias Krüger
b5f73dad90
deps: update cargo_metadata from 0.8.0 to 0.9.0
2019-10-23 17:30:24 +02:00
flip1995
e8d5a9e95c
Use StableHasher in SpanlessHasher
2019-10-22 14:57:44 +02:00
flip1995
ef18ece564
Don't hash spans in SpanlessHasher
2019-10-22 11:17:16 +02:00
Marcel Hellwig
5572476a36
Add lint for debug_assert_with_mut_call
...
This lint will complain when you put a mutable function/method call
inside a `debug_assert` macro, because it will not be executed in
release mode, therefore it will change the execution flow, which is not
wanted.
2019-10-22 10:39:55 +02:00
Lzu Tao
4c7387e965
rustup https://github.com/rust-lang/rust/pull/65535
2019-10-19 12:27:21 +07:00
HMPerson1
a9cb2b9001
Fix suggestion for ranges
2019-10-18 12:11:15 -04:00
Andre Bogus
d723b35aee
Omit proc macros from must_use_candidate
2019-10-18 15:54:25 +02:00
Heinz N. Gies
7f454d8d06
Split out tests
2019-10-18 07:40:48 +02:00
Heinz N. Gies
a7ad78f3eb
Add expect
...
Co-Authored-By: Philipp Krones <hello@philkrones.com>
2019-10-18 07:37:58 +02:00
Heinz N. Gies
98dc3aabea
Add todo and tests
2019-10-18 07:37:58 +02:00
Heinz Gies
8d911fe988
add restirction for unreachable and panic
2019-10-18 07:35:25 +02:00
HMPerson1
4578e5e15e
Fix suggestion span in explicit_counter_loop
2019-10-18 01:15:54 -04:00
HMPerson1
72f3439346
Suggest calling iter
if needed in explicit_counter_loop
2019-10-18 00:03:27 -04:00
bors
14a0f36617
Auto merge of #4683 - HMPerson1:inefficient_to_string, r=Manishearth
...
Add `inefficient_to_string` lint
Closes #4586
changelog: Add `inefficient_to_string` lint, which checks for calling `to_string` on `&&str`, which would bypass the `str`'s specialization
2019-10-17 23:48:55 +00:00
Michael Zhang
2106a23966
Update help text in inefficient_to_string
...
Co-Authored-By: Manish Goregaokar <manishsmail@gmail.com>
2019-10-17 19:13:32 -04:00
Manish Goregaokar
fcad3cb9ea
syntax::ext -> syntax_expand
2019-10-17 15:57:48 -07:00
HMPerson1
106a72592c
Dogfood for inefficient_to_string
2019-10-16 17:12:41 -04:00
HMPerson1
76b44f34b9
Add inefficient_to_string
lint
2019-10-16 15:54:20 -04:00
Manish Goregaokar
608d09c26c
Rustup to rustc 1.40.0-nightly (237d54ff6 2019-10-15)
2019-10-15 12:29:28 -07:00
flip1995
c9dc2b5f6e
Fix ICE in use_self lint
2019-10-15 15:11:29 +02:00
James Wang
adf58868e9
Change terminology from static to associated
2019-10-15 09:58:12 +02:00
James Wang
8b50599cb4
Switch to OnlyBodies
2019-10-15 09:58:12 +02:00
James Wang
e23a424b31
Change lint to be pedantic
2019-10-15 09:58:11 +02:00
James Wang
e64b27525b
Remove prints
2019-10-15 09:58:11 +02:00
James Wang
664522badd
Add a new lint for unused self
2019-10-15 09:58:11 +02:00
Andre Bogus
cc622608db
new lints around #[must_use]
fns
...
`must_use_unit` lints unit-returning functions with a `#[must_use]`
attribute, suggesting to remove it.
`double_must_use` lints functions with a plain `#[must_use]`
attribute, but which return a type which is already `#[must_use]`,
so the attribute has no benefit.
`must_use_candidate` is a pedantic lint that lints functions and
methods that return some non-unit type that is not already
`#[must_use]` and suggests to add the annotation.
2019-10-14 12:09:04 +02:00
Matthias Seiffert
15b433af48
Use match_function_call wherever possible
2019-10-10 20:06:04 +02:00
Matthias Seiffert
37a2de1562
Move match_function_call to utils
2019-10-10 10:57:12 +02:00
bors
db233b0920
Auto merge of #4616 - mati865:license, r=Manishearth
...
Fix license in Cargo.toml files
Missed in https://github.com/rust-lang/rust-clippy/pull/3269
changelog: none
r? @Manishearth
2019-10-09 16:09:26 +00:00
Nikos Filippakis
5143fe1a78
New lint: suspicious_unary_op_formatting
...
Lints when, on the RHS of a BinOp, there is a UnOp without a space
before the operator but with a space after (e.g. foo >- 1).
Signed-off-by: Nikos Filippakis <nikolaos.filippakis@cern.ch>
2019-10-09 16:22:00 +02:00
bors
d97fbdbb42
Auto merge of #4635 - Lythenas:suggestions-for-assert-false, r=flip1995
...
Add assert message to suggestion in lint assertions_on_constants
<!--
Thank you for making Clippy better!
We're collecting our changelog from pull request descriptions.
If your PR only updates to the latest nightly, you can leave the
`changelog` entry as `none`. Otherwise, please write a short comment
explaining your change.
If your PR fixes an issue, you can add "fixes #issue_number" into this
PR description. This way the issue will be automatically closed when
your PR is merged.
If you added a new lint, here's a checklist for things that will be
checked during review or continuous integration.
- [x] Followed [lint naming conventions][lint_naming]
- [x] Added passing UI tests (including committed `.stderr` file)
- [ ] `cargo test` passes locally
- [x] Executed `./util/dev update_lints`
- [ ] Added lint documentation
- [ ] Run `./util/dev fmt`
[lint_naming]: https://rust-lang.github.io/rfcs/0344-conventions-galore.html#lints
Note that you can skip the above if you are just opening a WIP PR in
order to get feedback.
Delete this line and everything above before opening your PR -->
- [x] suggest replacing `assert!(false, "msg")` with `panic!("msg")`
- [x] extend to allow ~~variables~~ any expression for `"msg"`
- ~~suggest replacing `assert!(false, "msg {}", "arg")` with `panic!("msg {}", "arg")`~~
changelog: add assert message to suggestion in lint assertions_on_constants
Work towards fixing: #3575
2019-10-09 08:56:30 +00:00
Ethan Lam
327c91f8c7
Addresses Issue #4001
...
Fixed typo
Fixes lint name and uses appropriate linting suggestion
changed lint help message
Added autofixable test
Added Autofixable Test
Removed Broken Autofixable File
updated lints
Generated Autofixable/Nonfixable Test Cases
Changed Suggestion Applicability
Updated Lint Count
2019-10-08 08:46:29 -05:00
bors
30a3992e97
Auto merge of #4627 - kerhong:fix-typo-in-inherent-to-string, r=phansch
...
Fix typo in inherent_to_string documentation
A simple typo fix in `inherent_to_string` and `inherent_to_string_shadow_display` documentation
changelog: none
2019-10-08 07:52:44 +00:00
bors
b690cdb1e7
Auto merge of #4611 - rust-lang:doc-visibility, r=flip1995
...
account for doc visibility
This fixes #4608 .
Also I noticed that the lint failed to look at trait and impl items. There's a small bit of fallout in the code, too, but not enough to warrant its own commit.
changelog: check docs of trait items and impl items, also make `missing_safety_doc` account for visibility
2019-10-08 07:11:26 +00:00
bors
e2393b09ac
Auto merge of #4592 - rust-lang:transmute-collection, r=flip1995
...
New lint: `unsound_collection_transmute`
changelog: Add `unsound_collection_transmute` lint
This fixes #4515
2019-10-08 05:51:07 +00:00
Matthias Seiffert
6ee8d751f6
Reduce duplication
2019-10-07 22:08:00 +02:00
Matthias Seiffert
22f057972f
Match any expr for panic message
2019-10-07 20:40:05 +02:00
Matthias Seiffert
d66acc23a9
Make if_chain more readable
2019-10-07 19:13:10 +02:00
Matthias Seiffert
72a5d7b612
Add message to replace assert!(false) help
2019-10-07 19:13:10 +02:00
flip1995
3d39379f9c
Move is_argument check into mutate
2019-10-06 14:49:26 +02:00
flip1995
3aa531c194
Run util/dev fmt
2019-10-05 12:42:09 +02:00
flip1995
3b23092b69
Get rid of rvalue_promotable_map method call
2019-10-05 12:38:38 +02:00
flip1995
b7d473503b
Merge consume and consume_pat in escape analysis
...
FIXME: This doesn't work and probably needs a rewrite of the lint
See https://github.com/rust-lang/rust-clippy/pull/4628#issuecomment-538574944
2019-10-05 12:23:59 +02:00
Mateusz Mikuła
4f1d907462
Use new format of licenses
...
Co-Authored-By: lzutao <taolzu@gmail.com>
2019-10-04 17:40:32 +02:00
flip1995
c420b07191
Fix needless_pass_by_value
...
This also accidentally improved the spans of the suggestions
2019-10-04 15:39:46 +02:00
flip1995
b46f5b4a98
Rustup to rust-lang/rust#64874
...
Episode 1 - The simple cases
2019-10-04 15:39:46 +02:00
bors
54bf4ffd62
Auto merge of #4613 - Lythenas:lint-assert_eq-unit_exprs, r=flip1995
...
Add check for assert_eq macros to unit_cmp lint
changelog: Add check for unit comparisons through `assert_eq!`, `debug_assert_eq!`, `assert_ne!` and `debug_assert_ne!` macros to unit_cmp lint.
fixes #4481
2019-10-04 10:27:44 +00:00
Edgars Baduns
a1137a8439
Fix typo in inherent_to_string documentation
2019-10-04 10:58:53 +01:00
bors
249b6cac3e
Auto merge of #4625 - phansch:rollup-qp7ki0h, r=phansch
...
Rollup of 2 pull requests
Successful merges:
- #4509 (Fix false-positive of redundant_clone and move to clippy::perf)
- #4614 (Allow casts from the result of `abs` to unsigned)
Failed merges:
changelog: none
r? @ghost
2019-10-04 06:45:04 +00:00
Phil Hansch
19c58d260b
Rollup merge of #4614 - HMPerson1:abs_cast_unsigned, r=flip1995
...
Allow casts from the result of `abs` to unsigned
changelog: Allow casts from the result of `abs` to unsigned in `cast_sign_loss`
Fixes #4605
2019-10-04 08:08:59 +02:00
Matthias Seiffert
e333ed0d53
Correctly align doc of mistyped literal suffixes
2019-10-03 22:14:32 +02:00
Mateusz Mikuła
d743a8992a
Fix license in Cargo.toml files
2019-10-03 19:55:05 +02:00
Matthias Seiffert
5a0a2b383c
Remove assert_ne example from doc
2019-10-03 19:53:41 +02:00
Matthias Seiffert
fb25d56799
Mention asserts in doc for unit_cmp lint
2019-10-03 14:35:05 +02:00
Matthias Seiffert
288f02da44
Print assert macro name in backticks
...
Co-Authored-By: Philipp Krones <hello@philkrones.com>
2019-10-03 11:43:39 +02:00
Shotaro Yamada
4cded6d901
extern rustc_index
2019-10-03 08:27:47 +09:00
Shotaro Yamada
866729f5db
Add comments
2019-10-03 08:10:29 +09:00
Shotaro Yamada
1cee3fe00e
Resolve reviews
2019-10-03 08:10:29 +09:00
Shotaro Yamada
a3f403aa50
Apply suggestion
...
Co-Authored-By: ecstatic-morse <ecstaticmorse@gmail.com>
2019-10-03 08:10:29 +09:00
Shotaro Yamada
667223c35d
Add run-rustfix
2019-10-03 08:10:29 +09:00
Shotaro Yamada
301ef6bb2a
Fix false-positive of redundant_clone and move to clippy::perf
2019-10-03 08:10:29 +09:00
HMPerson1
0e1dd65c14
Allow casts from the result of abs
to unsigned
2019-10-02 17:23:54 -04:00
Matthias Seiffert
3557084b01
Add check for assert_eq macros to unit_cmp lint
2019-10-02 22:48:19 +02:00
Andre Bogus
27fa2b7944
New lint: unsound_collection_transmute
2019-10-02 21:18:00 +02:00
Andre Bogus
e3f143ff0a
account for doc visibility
2019-10-02 21:15:28 +02:00
bors
737f0a6bb5
Auto merge of #4599 - lzutao:zero-ptr-suggestion, r=flip1995
...
Add suggestion for zero-ptr lint
changelog: Improve suggestion of `zero_ptr` lint
2019-10-02 17:16:29 +00:00
Lzu Tao
6b1a8683f4
Add suggestion for zero-ptr lint
2019-10-02 22:38:00 +07:00
Andre Bogus
23a9c02120
New lint: needless_doc_main
2019-10-02 17:17:22 +02:00
flip1995
93bda4876a
Fix ICE #4579
2019-10-02 09:39:04 +02:00
Manish Goregaokar
9e166e09b8
Use new spans for expansion checking in loop lints
2019-10-01 10:17:29 -07:00
Lzu Tao
aa4f3fb537
Clean up some unused vars
2019-09-29 23:46:32 +07:00
Lzu Tao
6e3a0ea6b3
Rustup rust-lang/rust#63492
2019-09-29 22:58:17 +07:00
bors
fe920ebf8b
Auto merge of #4593 - james9909:fix-multiple-inherent-impls, r=llogiq
...
Fix false positive in `multiple_inherent_impl`
changelog: Fix false positive in `multiple_inherent_impl` by ignoring impls derived from macros.
Closes #4578 .
2019-09-29 06:21:55 +00:00
Matthias Krüger
5f6e3f35b5
rustup https://github.com/rust-lang/rust/pull/64781/
...
cc https://github.com/rust-lang/rust/issues/64867
2019-09-28 10:42:41 +02:00
James Wang
189eaa54c6
Ignore impls derived from macros
2019-09-27 20:47:00 -05:00
flip1995
8d8ba14371
Fix author lint
2019-09-27 18:01:04 +02:00
flip1995
4bbd10a585
Rustup to rust-lang/rust#64813
2019-09-27 17:21:20 +02:00
Michael Wright
8b9415cd88
Refactor booleans
...
Remove unused output from `suggest(..)`
2019-09-27 07:59:34 +02:00
Michael Sproul
4f9d6eea5c
Detect assignment ops in integer_arithmetic
2019-09-27 11:55:42 +10:00
Matthias Krüger
e59d619981
rustup https://github.com/rust-lang/rust/pull/64515
...
changelog: none
2019-09-26 18:34:43 +02:00
Lzu Tao
54371929d2
Remove unused import
2019-09-26 16:08:30 +07:00
Lzu Tao
a7b7e19f49
Rustup https://github.com/rust-lang/rust/pull/64513
2019-09-26 16:03:36 +07:00
bors
adc1df11b4
Auto merge of #4568 - mikerite:fix-4548, r=flip1995
...
Fix `nonminimal-bool` false positive
Closes #4548
Closes #3847
changelog: Fix `nonminimal-bool` false positive
2019-09-26 08:06:16 +00:00
bors
4d30b08027
Auto merge of #4569 - james9909:add-comparison-chain, r=oli-obk
...
Add a new lint for comparison chains
changelog: Adds a new lint: `comparison_chain`.
`comparison_chain` lints all `if` conditional chains where all the conditions are binary comparisons on the same two operands and will suggest a rewrite with `match`.
Closes #4531 .
2019-09-26 07:38:08 +00:00
Lzu Tao
08ce6bc6d9
Fix macro expansion in toplevel_ref_arg lint
2019-09-26 08:46:51 +07:00
Manish Goregaokar
49374a4380
Downgrade op_ref to a MaybeIncorrect suggestion
2019-09-25 14:53:48 -07:00
Manish Goregaokar
d28dacb33a
redundant_pattern_matching: make rustfixable
2019-09-25 14:45:18 -07:00
Manish Goregaokar
a83a8dccba
redundant_closure_call: split tests into fixable
2019-09-25 14:45:18 -07:00
Manish Goregaokar
ad0e7c8e7f
map_unit_fn: fix applicability
2019-09-25 14:45:18 -07:00
Manish Goregaokar
1090509564
non_copy_const: remove incorrect suggestion
2019-09-25 14:45:18 -07:00
Manish Goregaokar
980650eec2
needless_collect: fix suggestion, make test rustfixable
2019-09-25 14:45:18 -07:00
Manish Goregaokar
7f822e742d
needless_borrowed_ref: fix false positive, make rustfixable
2019-09-25 14:45:18 -07:00
Manish Goregaokar
4368771548
map_entry test: Fix semicolon, add run-rustfix
2019-09-25 14:45:18 -07:00
Manish Goregaokar
d445bf2e89
Remove suggestion for complex map_entry cases
2019-09-25 13:54:53 -07:00
Manish Goregaokar
b5cadd734e
ignore single-match for or patterns
2019-09-25 13:34:55 -07:00
Manish Goregaokar
982c51e769
arm.pats -> arm.pat
2019-09-25 12:52:16 -07:00
Michael Wright
89cdd26e71
Refactor booleans
...
Inline `snip (..)` function
2019-09-25 06:40:04 +02:00
James Wang
2f34576c18
Update refactor according to code review
2019-09-24 19:07:03 -05:00
James Wang
7e8afe2001
Fix example in docs
2019-09-24 17:05:43 -05:00
James Wang
52408f5b7d
Add a new lint for comparison chains
2019-09-24 16:55:05 -05:00
Michael Wright
0cc48ad9f9
Fix nonminimal-bool
false positive
...
Closes #4548
Closes #3847
2019-09-24 08:13:50 +02:00
Andre Bogus
2b7514154d
Fix let_and_return lint
2019-09-23 09:17:18 +02:00
Michael Wright
ca6d36ba22
Merge branch 'master' into unneeded_wildcard_pattern
2019-09-23 05:26:47 +02:00
Cyril Plisko
4c881d108a
clippy::cargo_common_metadata: check for license-file
...
When license property is missing in Cargo.toml check for license-file
as it may be used instead of the former. The check implemented here is
very naive as it only verifies that the field is present and is not
empty. More scrutiny can be applied by verifying the file is actually
present.
Fixes #4517
2019-09-22 10:49:36 +03:00
Michael Wright
d04bf15114
Merge branch 'master' into unneeded_wildcard_pattern
2019-09-22 08:59:23 +02:00
bors
f21cd81949
Auto merge of #4558 - Manishearth:suggestions, r=phansch
...
Make more tests rustfixable
changelog: Fix various lint suggestions
Progress towards https://github.com/rust-lang/rust-clippy/issues/3630
r? @phansch
2019-09-21 01:01:21 +00:00
Manish Goregaokar
bbfb9a49e3
for_loop: Split test into fixable/unfixable, make needless_range_loop use updated range syntax
2019-09-21 10:01:06 +09:00
Manish Goregaokar
fa969762a4
assign_ops: Remove MachineApplicable
2019-09-20 14:51:28 +09:00
Andre Bogus
8d884c8a1a
new lint: mem-replace-with-uninit
2019-09-20 00:25:57 +02:00
bors
cdaa93d695
Auto merge of #4544 - JoshMcguigan:issue-4542, r=flip1995
...
#4542 remove machine applicable suggestion
This helps #4542 (but does not completely resolve) by removing the machine applicable suggestion (which was incorrect) for that case.
I would have preferred to fix the machine applicable suggestion to handle format strings, but that's a bit beyond my current understanding of the clippy codebase. I'd be happy to give it a try given some guidance.
changelog: only produce machine applicable suggestions on `explicit_write` lint
2019-09-19 09:28:29 +00:00
bors
f08f171530
Auto merge of #4539 - jolson88:cast-lossless-pedantic, r=flip1995
...
Changes cast-lossless to a pedantic lint
As discussed in #4528 , this moves the cast-lossless lint from `all` to `pedantic`.
I couldn't tell from description alone if it should also be removed from the complexity category, so I left it as part of complexity for now. I didn't see any impact to the tests from this change, but I could be wrong (as this is my first PR).
fixes #4528
changelog: Moves cast-lossless from default to checking only as a `pedantic` lint.
2019-09-19 08:50:31 +00:00
Andre Bogus
70a7dab773
New lint: Require # Safety
section in pub unsafe fn docs
2019-09-19 09:19:55 +02:00
Michael Wright
16ce071bed
Work around qpath_res issue
2019-09-18 21:57:14 +02:00
Josh Mcguigan
24ec994001
remove machine applicable suggestion explicit_write format #4542
2019-09-18 01:59:58 -07:00
mikerite
fed1709f46
Add note about refactoring
...
Co-Authored-By: Philipp Krones <hello@philkrones.com>
2019-09-18 06:48:47 +02:00
Jason Olson
6f1f413717
Changes cast-lossless to a pedantic lint
...
Fixes #4528
2019-09-15 10:32:45 -07:00
Jason Olson
80822b430d
Convert to Place's new boxed slice projection
...
Fixes breaking change from rust-lang PR https://github.com/rust-lang/rust/pull/63420/
2019-09-13 18:49:11 -07:00
Michael Wright
99be5221bc
Apply review suggestions
...
Fix grammar errors and use `Pat::is_rest` instead of own function.
2019-09-13 08:31:24 +02:00
Michael Wright
00ca42fe5b
Fix lint warnings
2019-09-12 08:36:05 +02:00
Michael Wright
4a3bc6b592
Add unneeded-wildcard-pattern
lint
2019-09-12 08:25:05 +02:00
bors
6ca5b2053a
Auto merge of #4478 - tsurai:master, r=flip1995
...
Fix incorrect swap suggestion
Clippy suggests using swap on fields belonging to the same owner causing two mutable borrows of the owner.
Disclosure: This is my first time working with clippy and rusts HIR. I'm very grateful for assistance and suggestions to improve the PR.
fixes #981
changelog: Fix false positive in `manual_swap` lint
2019-09-11 09:48:25 +00:00
Matthias Krüger
b72982759c
run rustfmt
2019-09-11 08:26:57 +02:00
bors
12bb7d668d
Auto merge of #4532 - rust-lang:integer-const, r=oli-obk
...
New `is_integer_const` to check more const ints
This mostly affects loop checks and the modulo_one lint. Tests were also updated where applicable.
changelog: none
2019-09-10 19:40:45 +00:00
Andre Bogus
5823e9468d
New is_integer_const
to check more const ints
...
This mostly affects loop checks and the modulo_one lint. Tests
were also updated where applicable.
2019-09-10 17:46:39 +02:00
bors
c53d2b824e
Auto merge of #4525 - mikerite:use-self-constructor, r=phansch
...
Extend `use_self` to check constructor
Rust did not allow this before.
changelog: Extend `use_self` to check constructor
2019-09-10 07:32:11 +00:00
Lzu Tao
b4d7f04a1d
Remove feature gate bind-by-move
2019-09-10 09:23:25 +07:00
bors
4ee8bc84cd
Auto merge of #4527 - rust-lang:more-vec-diag-items, r=oli-obk
...
Changed more `Vec` paths to diagnostic_items
In #4519 , I missed a few instances of path matching for `Vec`, so here they are.
r? @oli-obk
changelog: none
2019-09-09 16:56:51 +00:00
bors
c733376a5f
Auto merge of #4522 - mikerite:fix-4514, r=phansch
...
Fix `or_fun_call` bad suggestion
Closes #4514
changelog: Fix `or_fun_call` bad suggestion
2019-09-09 15:38:59 +00:00
Andre Bogus
507c03a859
Changed more Vec paths to diagnostic_items
2019-09-09 17:22:41 +02:00
bors
8af4e09605
Auto merge of #4458 - flip1995:block_in_if_ext_macro, r=phansch
...
Allow block_in_if_{stmt,expr} in external macro
I found this by running `cargo fix --clippy` on quite a big codebase.
You could refactor this assert to
```rust
let block_expr = _;
assert!(block_expr);
```
but,
1. it doesn't increase the readability IMO
2. That isn't possible in a `debug_assert!`
I'm not sure though, if we should allow this for macros in general or just for external macros.
changelog: Allow `block_in_if_{stmt,expr}` in external macros
2019-09-09 14:55:33 +00:00
Lzu Tao
a5f4d3ce29
Fix regression in case of proc-macro attribute expansion
2019-09-09 16:14:32 +07:00
Michael Wright
31fbff2a36
Extend use_self
to check constructor
...
Rust did not allow this before.
2019-09-09 07:51:44 +02:00
Michael Wright
f88c224d82
Merge branch 'master' into fix-4514
2019-09-09 07:36:30 +02:00
Andre Bogus
e3c4ffd4aa
Use diagnostic item for
2019-09-09 05:43:39 +02:00
Matthew Jasper
5e7ff6b705
Update non_expressive_names for or patterns
2019-09-08 16:27:54 +01:00
Matthew Jasper
a2477f7759
Remove use of the HIR CFG
2019-09-08 16:27:54 +01:00
Michael Wright
9bdfd0683f
Fix or_fun_call
bad suggestion
...
Closes #4514
2019-09-08 11:03:45 +02:00
bors
f30bf69ec7
Auto merge of #4508 - rust-lang:reduced-symbolism, r=phansch
...
Simplify `utils::match_def_path`, removing a FIXME
changelog: none
This removes the `Vec<Symbol>` allocation. We still need to call `cx.get_def_path`, but this should already have been interned, and I don't see how we can keep ergonomics of that function without allocating a `Vec`.
r? @phansch
2019-09-06 15:10:06 +00:00
Mateusz Mikuła
5afa216e30
Rustup to rust-lang/rust#64111
2019-09-06 13:57:27 +02:00
bors
9672a0400c
Auto merge of #4500 - jeremystucki:refactoring, r=flip1995
...
Small refactoring
changelog: none
2019-09-06 08:41:56 +00:00
Andre Bogus
72058a6d0d
Simplify , removing a FIXME
2019-09-06 09:40:36 +02:00
bors
313b41fac5
Auto merge of #4489 - JohnTitor:fix-redundant-pattern-false-positive, r=flip1995
...
Fix `redundant_pattern` false positive
Fix #4428
changelog: Fix `redundant_pattern` false positive
2019-09-05 16:15:36 +00:00
Lzu Tao
c12b700e87
Rustup "Minimize uses of LocalInternedString
"
2019-09-05 07:16:57 +00:00
bors
e3ae76aeac
Auto merge of #4495 - JohnTitor:fix-map-entry-false-positive, r=phansch
...
Fix `map_entry` false positive
Fixes #4219
changelog: Fix `map_entry` false positive
2019-09-04 16:25:49 +00:00
Yuki Okushi
8be37fdb1d
Make it auto fixable lint
2019-09-05 00:50:22 +09:00
Yuki Okushi
e236740f28
Fix redundant_pattern
false positive
2019-09-05 00:36:48 +09:00
bors
98a25241cc
Auto merge of #4487 - JohnTitor:deref-addrof-external-macro, r=flip1995
...
Don't check across macro boundary in `deref_addrof`
Fixes #4289
changelog: Allow `deref_addrof` in macros
2019-09-04 15:01:06 +00:00
Jeremy Stucki
3fc1ec1ffd
Refactor option handling
2019-09-04 16:19:59 +02:00
bors
9d2772207e
Auto merge of #4418 - euclio:byte-lit-suggestion, r=flip1995
...
use a structured suggestion for char-lit-as-u8
changelog: use a structured suggestion for char-lit-as-u8
2019-09-04 13:33:47 +00:00
Andy Russell
4ea246b0b3
use a structured suggestion for char-lit-as-u8
2019-09-04 08:50:55 -04:00
bors
ffe57fad85
Auto merge of #4498 - sinkuu:checked_arithmetic_unwrap, r=flip1995
...
Add manual_saturating_arithmetic lint
changelog: add `manual_saturating_arithmetic` lint
Fixes #1557 . This lint detects manual saturating arithmetics like `x.checked_add(10u32).unwrap_or(u32::max_value())` and suggests replacing with `x.saturating_add(10u32)`.
2019-09-04 12:14:41 +00:00
Shotaro Yamada
c6fb9c8a2a
Hide variables in doc-test
2019-09-04 21:10:08 +09:00
Shotaro Yamada
45fde0f86f
Fix doctest and renaming src
2019-09-04 21:06:28 +09:00
bors
a2c4b2b8da
Auto merge of #4490 - mikerite:fix-4364, r=flip1995
...
Fix `too_many_lines` false positive
changelog: Fix `too_many_lines` false positive
2019-09-04 11:35:13 +00:00
Shotaro Yamada
4960f79476
Add manual_saturating_arithmetic lint
2019-09-04 18:38:25 +09:00
bors
8239b7616f
Auto merge of #4454 - BO41:search_is_some, r=flip1995
...
Dereference one less on search_is_some and make it auto-fixable
Fixes #4453
changelog: none
2019-09-04 07:53:44 +00:00
BO41
64cd9e4d60
Try to fix .fixed
2019-09-03 18:56:23 +02:00
bors
11da8c18a2
Auto merge of #4479 - rust-lang:uninit_assume_init, r=flip1995
...
lint against `MaybeUninit::uninit().assume_init()`
changelog: add `uninit_assumed_init` lint
This fixes #4272
2019-09-03 16:14:40 +00:00
Andre Bogus
b01f2d1126
lint against MaybeUninit::uninit().assume_init()
2019-09-03 17:37:38 +02:00
bors
aeadf1562c
Auto merge of #4486 - lzutao:fix-panic-unseparate-literals, r=flip1995
...
Fix index out of bound in case of empty snippet
cc #4480
changelog: none
2019-09-03 13:17:30 +00:00
Yuki Okushi
c94c5e9048
Fix map_entry
false positive
2019-09-03 20:31:02 +09:00
bors
2d7da04e17
Auto merge of #4493 - JohnTitor:fix-build-bytes, r=flip1995
...
Rustup to rust-lang/rust#63561
changelog: none
2019-09-03 10:44:47 +00:00
Yuki Okushi
7d30cb6e76
Remove Allocation::bytes
2019-09-03 18:29:08 +09:00
Michael Wright
232dd43fe9
Fix occurrences of too_many_lines
violations
2019-09-03 06:26:49 +02:00
Michael Wright
0ae1a69330
Fix too_many_lines
false positive
...
Fixes #4364
2019-09-03 06:25:54 +02:00
Yuki Okushi
9a5b996228
Allow deref_addrof in macros
2019-09-03 00:17:23 +09:00
Lzu Tao
17d445b66d
Fix index out of bound in case of empty snippet
2019-09-02 20:38:40 +07:00
bors
1f9993729b
Auto merge of #4482 - awoimbee:doc_explicit_counter_loop, r=flip1995
...
fix misleading doc for explicit_counter_loop lint
changelog: replace misleading examples for explicit_counter_loop & more concise `Why is it bad?` section
This fixes #4472
2019-09-02 12:46:13 +00:00
Arthur Woimée
223e23a5ce
fix misleading doc for explicit_counter_loop lint
2019-09-01 21:54:47 +02:00
Michael Wright
2fdfd60569
Fix needless_lifetimes
false positive
2019-09-01 08:11:40 +02:00
Cristian Kubis
8bc1ded805
Fix incorrect swap suggestion
...
Clippy suggests using swap on fields belonging to the same owner
causing two mutable borrows of the owner
Fixes #981
Signed-off-by: Cristian Kubis <cristian.kubis@tsunix.de>
2019-08-31 18:53:14 +02:00
Michael Wright
88750f9ad7
Fix extra_unused_lifetimes
false positive
...
Fixes #4291
2019-08-31 08:16:04 +02:00
bors
a3fcaee562
Auto merge of #4473 - phansch:fix_cast_lossless_fp, r=flip1995
...
Fix cast_lossless false positive in impl const fn
Fixes https://github.com/rust-lang/rust-clippy/issues/3656#issuecomment-526387382
changelog: Fix false positive in `cast_lossless`
2019-08-30 20:30:53 +00:00
flip1995
3c11406c1f
Rustup to rust-lang/rust#60966
2019-08-30 10:11:27 +02:00
bors
2bff3d87d5
Auto merge of #4446 - mikerite:fix-4437, r=phansch
...
Fix `match_as_ref` bad suggestion
Fixes #4437
changelog: Fix `match_as_ref` bad suggestion
2019-08-30 06:07:41 +00:00
Philipp Hansch
fb1ae1747f
Fix cast_lossless false positive in impl const fn
...
Fixes https://github.com/rust-lang/rust-clippy/issues/3656#issuecomment-526387382
2019-08-30 07:22:35 +02:00
bors
28a8a6a483
Auto merge of #4450 - phansch:fix_const_fn_fp, r=flip1995
...
Fix missing_const_for_fn false positive
We don't want to lint if the type of the method implements drop.
(constant functions cannot evaluate destructors)
changelog: Fix `missing_const_for_fn` false positive
Fixes #4449
2019-08-29 17:24:21 +00:00
flip1995
dac81d867b
Use the spans returned by utils::method_calls
2019-08-29 17:34:03 +02:00
flip1995
832c0830ec
Also return the method spans in utils::method_calls
2019-08-29 17:34:02 +02:00
BO41
945d4cf69f
Dereference one less on search_is_some and make it auto-fixable
2019-08-29 17:34:02 +02:00
bors
888b736560
Auto merge of #4408 - phansch:more_rustfix_tests, r=flip1995
...
More rustfix tests
<!--
Thank you for making Clippy better!
We're collecting our changelog from pull request descriptions.
If your PR only updates to the latest nightly, you can leave the
`changelog` entry as `none`. Otherwise, please write a short comment
explaining your change.
If your PR fixes an issue, you can add "fixes #issue_number" into this
PR description. This way the issue will be automatically closed when
your PR is merged.
If you added a new lint, here's a checklist for things that will be
checked during review or continuous integration.
- [ ] Followed [lint naming conventions][lint_naming]
- [ ] Added passing UI tests (including committed `.stderr` file)
- [ ] `cargo test` passes locally
- [ ] Executed `./util/dev update_lints`
- [ ] Added lint documentation
- [ ] Run `./util/dev fmt`
[lint_naming]: https://rust-lang.github.io/rfcs/0344-conventions-galore.html#lints
Note that you can skip the above if you are just opening a WIP PR in
order to get feedback.
Delete this line and everything above before opening your PR -->
cc #3630
This is probably easier reviewed per-commit.
changelog: none
2019-08-29 10:48:14 +00:00
Victor Polevoy
87ef86ef5a
Improve cognitive_complexity lint's warning.
...
Adds the value of complexity limit set for the lint
to the warning.
Fixes #4466
Signed-off-by: Victor Polevoy <fx@thefx.co>
2019-08-29 11:54:18 +02:00
Michael Wright
0c8332558b
Merge branch 'master' into fix-4437
2019-08-29 08:17:36 +02:00
Philipp Hansch
1b18597554
Fix missing_const_for_fn false positive
...
We don't want to lint if any of the input parameters implement drop.
(constant functions cannot evaluate destructors)
2019-08-29 08:07:41 +02:00
Philipp Hansch
eeeadf30bf
Make useless_attribute suggestion MaybeIncorrect
2019-08-28 21:17:12 +02:00
Philipp Krones
236666138f
Rollup merge of #4460 - JohnTitor:fix-inherent-to-string, r=flip1995
...
Fix `inherent_to_string` false positive
Fixes #4457
changelog: fixes `inherent_to_string` false positive
2019-08-28 13:00:52 +02:00
Yuki Okushi
2c282252a9
Replace Arg
with Param
2019-08-28 18:33:25 +09:00
Philipp Hansch
f41677902d
Update int_plus_one suggestion text
...
This is now in line with the recommendations from here:
https://doc.rust-lang.org/nightly/nightly-rustc/rustc_errors/struct.Diagnostic.html#method.span_suggestion
2019-08-28 07:29:30 +02:00
Philipp Hansch
31cf2f2f35
Change float_cmp Applicability to HasPlaceholders
...
The suggestion includes an 'errors' placeholder currently, so it's not
`MachineApplicable`
2019-08-28 07:23:23 +02:00
Yuki Okushi
1dca950ac4
Fix inherent_to_string
false positive
2019-08-28 06:46:26 +09:00
flip1995
d36c785344
Allow block_in_if_{stmt,expr} in external macro
2019-08-27 09:43:03 +02:00
bors
fea888f2ec
Auto merge of #4445 - phansch:fix_unused_unit_sugg, r=flip1995
...
Fix unused_unit false positive
changelog: Fix `unused_unit` false positive
For some reason the `expr` of `stmt.node` didn't contain the expansion information, but the `stmt.span` does.
Fixes #4076
2019-08-26 13:29:01 +00:00
bors
f760088820
Auto merge of #4430 - lzutao:defid_trait_alias, r=flip1995
...
Account for trait alias when looking for defid
I hit the crash on the `expect` call when running clippy on rustc libcore.
Hopefully this will fix it.
changelog: none
2019-08-26 12:46:00 +00:00
bors
ba6681300e
Auto merge of #4436 - BO41:written_as, r=phansch
...
Add some "could be written as" examples
fixes #4405
changelog: none
2019-08-26 11:11:57 +00:00
Lzu Tao
c1a4b26406
Cleaner code for unsep literals
2019-08-26 16:11:43 +07:00
Lzu Tao
dac2509bac
Account for trait alias when looking for defid
2019-08-25 20:36:11 +07:00
Philipp Hansch
818b2ccfc5
Rustup to https://github.com/rust-lang/rust/pull/63854
2019-08-25 08:06:32 +02:00
Michael Wright
23336adf84
Fix match_as_ref
bad suggestion
...
Fixes #4437
2019-08-25 07:10:45 +02:00
Philipp Hansch
957dedb11d
Fix unused_unit false positive
...
Fixes #4076
2019-08-24 22:09:02 +02:00
BO41
31a6ab47e1
Fix lint doc
2019-08-24 13:57:25 +02:00
bors
2bcb615594
Auto merge of #4443 - jeremystucki:methods-refactoring, r=phansch
...
Small refactoring of methods/mod.rs
changelog: none
2019-08-24 07:45:29 +00:00
Jeremy Stucki
2da8288433
Refactor some minor things
2019-08-23 22:52:04 +02:00
Jeremy Stucki
907aebcf8b
Use more if-chains
2019-08-23 22:51:44 +02:00
Jeremy Stucki
4130dfba2e
Refactor 'lint_or_fun_call'
2019-08-23 22:31:22 +02:00
Jeremy Stucki
419c87fb35
Refactor 'check_unwrap_or_default'
2019-08-23 14:36:00 +02:00
Jeremy Stucki
1436fea271
Refactor 'check_impl_item'
2019-08-23 14:20:55 +02:00
Lzu Tao
5b367ed4a3
Add missing field to LitKind::Str
2019-08-23 18:02:13 +07:00
Lzu Tao
f717a77ecc
Re-add false positive check
2019-08-23 09:16:50 +00:00
Lzu Tao
ce2d2920ef
Add raw string regression test for useless_format lint
2019-08-23 09:16:50 +00:00
Lzu Tao
09d302a786
Re-factor useless_format lint
2019-08-23 09:16:50 +00:00
Lzu Tao
4134e608c5
Update Unicode lint tests
2019-08-23 05:42:45 +00:00
BO41
eebb7cd839
Add examples to some complexity lints
2019-08-22 15:41:07 +02:00
BO41
3f56cb5d8b
Add example to a perf lint
2019-08-22 15:41:07 +02:00