Philipp Hansch
5029dfe403
Use exec_env to set backtrace level and normalize output
2019-11-29 20:47:50 +01:00
Philipp Hansch
fc57c84abe
Use Clippy version in ICE message
2019-11-29 20:47:50 +01:00
Philipp Hansch
676f14baa0
Add custom ICE message that points to Clippy repo
...
This utilizes https://github.com/rust-lang/rust/pull/60584 by setting
our own `panic_hook` and pointing to our own issue tracker instead of
the rustc issue tracker.
This also adds a new internal lint to test the ICE message.
**Potential downsides**
* This essentially copies rustc's `report_ice` function as
`report_clippy_ice`. I think that's how it's meant to be implemented, but
maybe @jonas-schievink could have a look as well =)
The downside of more-or-less copying this function is that we have to
maintain it as well now.
The original function can be found [here][original].
* `driver` now depends directly on `rustc` and `rustc_errors`
Closes #2734
[original]: 59367b074f/src/librustc_driver/lib.rs (L1185)
2019-11-29 20:47:47 +01:00
Philipp Krones
82066d2f0e
Use println!
on success instead of eprintln!
...
Co-Authored-By: Phil Hansch <dev@phansch.net>
2019-11-28 17:48:29 +01:00
flip1995
3e1139a7dc
Rust implementation of integration test
2019-11-28 16:55:21 +01:00
bors
dbdd75ab52
Auto merge of #4855 - phansch:rollup-x7yail7, r=phansch
...
Rollup of 3 pull requests
Successful merges:
- #4832 (Add some positive examples to lint docs)
- #4842 ([comparison_chain] #4827 Check `core::cmp::Ord` is implemented)
- #4847 (fixing a typo)
Failed merges:
changelog: none
r? @ghost
2019-11-28 09:30:16 +00:00
Phil Hansch
1165176840
Rollup merge of #4842 - timbodeit:comparison-chain-false-positive-4827, r=flip1995
...
[comparison_chain] #4827 Check `core::cmp::Ord` is implemented
Only emit `comparison_chain` lint, if `cmp` is actually available on the type being compared. Don't emit lint in cases where only `PartialOrd` is implemented.
I haven't yet fully understood [Adjustments](https://doc.rust-lang.org/nightly/nightly-rustc/rustc/ty/adjustment/struct.Adjustment.html ). I would appreciate, if someone could double check whether my usage of [expr_ty](https://doc.rust-lang.org/nightly/nightly-rustc/rustc/ty/struct.TypeckTables.html#method.expr_ty ) in `clippy_lints/src/comparison_chain.rs:91` is correct or if there are cases where using [expr_ty_adjusted](https://doc.rust-lang.org/nightly/nightly-rustc/rustc/ty/struct.TypeckTables.html#method.expr_ty_adjusted ) would lead to a different result when used with `utils::implements_trait`.
---
fixes #4827
changelog: [comparison_chain] Check `core::cmp::Ord` is implemented
2019-11-28 10:19:05 +01:00
bors
f3288eb48d
Auto merge of #4851 - daxpedda:float-arithmetic, r=flip1995
...
Remove negative float literal checks.
Fixes #4850 .
changelog: Remove negative float literal checks.
2019-11-28 09:11:45 +00:00
bors
d377486561
Auto merge of #4821 - Areredify:as_conversions, r=flip1995
...
Add `as_conversions` lint
changelog: closes #4771 , adding a new pedantic allow-by-default lint that lints against any usage of `as`.
2019-11-28 08:53:36 +00:00
bors
d6accfcc82
Auto merge of #4808 - euclio:string-lit-as-bytes, r=phansch
...
trigger string_lit_as_bytes when literal has escapes
---
changelog: fix string_lit_as_bytes false negative
Depends on rust-lang/rust#66349.
Fixes #4796 .
2019-11-28 07:26:04 +00:00
Lzu Tao
d0e0ffa99f
make use of Result::map_or
2019-11-28 10:52:20 +07:00
Manish Goregaokar
73646487af
Add blank stderr file for cant_be_const test
2019-11-27 15:09:48 -08:00
Manish Goregaokar
341e266508
Add BorrowKind::Ref
2019-11-27 14:39:28 -08:00
Andy Russell
d33ad45d7d
trigger string_lit_as_bytes when literal has escapes
2019-11-26 17:07:17 -05:00
daxpedda
e46bedca3c
Remove negative float literal checks.
2019-11-25 19:23:28 +01:00
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
d2d62de841
Rustup to rust-lang/rust#64856
2019-11-25 13:56:24 +01:00
flip1995
d43c424145
Rustup to rust-lang/rust#66671
2019-11-25 13:18:38 +01:00
Tim Bodeit
fff9a8ea9c
[comparison_chain] #4827 Check core::cmp::Ord
is implemented
...
Only emit lint, if `cmp` is actually available on the type being
compared. Don't emit lint in cases where only `PartialOrd` is
implemented.
2019-11-24 10:00:06 +01:00
bors
cc35165f52
Auto merge of #4840 - flip1995:rollup-jqk3a3i, r=flip1995
...
Rollup of 5 pull requests
Successful merges:
- #4730 (Fix check_infinite_loop (while_immutable_condition) by checking for break or return inside loop body)
- #4766 (Fix false positive in derive_hash_xor_eq)
- #4811 (Literal Representation Restructure)
- #4820 (doc: fix the comment above the lint function)
- #4830 (use more efficient code to generate repeated string)
Failed merges:
r? @ghost
changelog: none
2019-11-23 17:40:57 +00:00
Philipp Krones
623d8c4640
Rollup merge of #4811 - mikerite:lit_repr_20191113, r=flip1995
...
Literal Representation Restructure
This pull request restructures the literal_representation module to be easier to understand and maintain. I split the changes into a lot of commits to make reviewing easier.
changelog: none
2019-11-23 18:16:00 +01:00
Philipp Krones
93d84d7dda
Rollup merge of #4766 - phansch:fix_fp_in_derive_hash_xor_eq, r=flip1995
...
Fix false positive in derive_hash_xor_eq
This fixes a false positive in derive_hash_xor_eq where the lint was
triggering on user-defined traits called `Hash`.
changelog: Fix false positive in `derive_hash_xor_eq`
Fixes #4658
2019-11-23 18:15:59 +01:00
Philipp Krones
016857db65
Rollup merge of #4730 - yerke:fix-check_infinite_loop, r=flip1995
...
Fix check_infinite_loop (while_immutable_condition) by checking for break or return inside loop body
changelog: Fix check_infinite_loop (while_immutable_condition) by checking for break or return inside loop body
fixes #4648
2019-11-23 18:15:58 +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
flip1995
d151ef7437
Merge remote-tracking branch 'upstream/zst-offset' into rollup-new-lints
2019-11-23 17:53:41 +01:00
Yerkebulan Tulibergenov
1cba0c9f7d
fix check_infinite_loop by checking for break or return inside loop body
2019-11-22 09:13:46 -08:00
flip1995
e3a74ed2b5
Set mir_opt_level=0
...
This introduces some FNs. But a building Clippy is more important for now
2019-11-22 14:25:44 +01:00
flip1995
cadc35af5a
Rustup to rust-lang/rust#66389
2019-11-22 13:47:33 +01:00
flip1995
3c308b86c8
Remove never_type feature
...
Stablized in rust-lang/rust#65355
2019-11-22 13:47:33 +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
Manish Goregaokar
d183bda0be
Rustup to rustc 1.41.0-nightly (d1da8023d 2019-11-19)
2019-11-19 00:32:35 -08:00
Manish Goregaokar
aa5a95f00c
Rustup to rustc 1.41.0-nightly (a0d40f8bd 2019-11-18)
2019-11-18 23:49:58 -08:00
Andre Bogus
c21b198576
New lint: zst_offset
2019-11-15 22:39:27 +01:00
Florian Rohm
f8f7800b18
add new lint tabs in doc comments
2019-11-15 16:25:47 +01:00
Michael Wright
ceb0b2d41a
literal repr: ignore more warnings in macros
2019-11-14 08:19:02 +02:00
Michael Wright
75e2dcf56b
literal representation: simplification
...
Simplify calculation in grouping. Add test case to ensure `count()`
can't be zero in that branch.
2019-11-14 07:42:04 +02:00
Areredify
7fddac0404
Add new lint: large stack array
...
added documentation
minor style fix
change as to ::from
add ignore to doc
include threshold in lint message/make suggestion more apparent/use Scalar api instead of matching
style fix
shange snippet_opt to snippet
2019-11-13 21:44:29 +03:00
Michael Wright
2d244d3358
literal representation restructure 4
...
Simplify `grouping_hint` by splitting digits into parts and handling
one at a time.
Fixes #4762
2019-11-13 08:27:19 +02:00
Andre Bogus
5f0f67375d
no more must-use-candidate on trait impls
2019-11-12 23:36:22 +01:00
Andy Russell
add766493a
don't warn on CRLF in with_newline
lints
2019-11-12 08:50:22 -05:00
bors
2646b108d5
Auto merge of #4803 - tomprogrammer:issue-4732, r=phansch
...
Fix false positive in explicit_counter_loop lint
When the counter was used in a closure after the loop the lint didn't detect the
usage of the counter correctly.
changelog: Fix false positive in `explicit_counter_loop`
Fixes #4732
2019-11-11 19:24:20 +00:00
Manish Goregaokar
e9a3e54910
MutImmutable -> Immutable, MutMutable -> Mutable, CaptureClause -> CaptureBy
2019-11-11 10:58:39 -08:00
bors
79d3b30cd7
Auto merge of #4801 - mikerite:to_digit_is_some, r=flip1995
...
To digit is some
Add a lint that recommends replacing `to_digit().is_some()` with `is_digit()` on `char`s
changelog: Add lint `to_digit_is_some`
2019-11-11 11:28:27 +00:00
Thomas Bahn
c88afce6fc
Fix false positive in explicit_counter_loop lint
...
When the counter was used in a closure after the loop the lint didn't detect the
usage of the counter correctly.
2019-11-11 11:36:53 +01:00
Philipp Hansch
78b7e8544b
Fix false positive in derive_hash_xor_eq
...
This fixes a false positive in derive_hash_xor_eq where the lint was
triggering on user-defined traits called `Hash`.
2019-11-11 07:59:53 +01:00
bors
338f5e6801
Auto merge of #4780 - flip1995:ice_4775, r=phansch
...
Fix ICE #4775
Fixes #4775
changelog: Fix ICE with const_generics
2019-11-11 06:23:27 +00:00
Michael Wright
5817a4fa06
Add to_digit_is_some
lint
2019-11-10 15:52:59 +02:00
msizanoen1
805fef0301
Only pass rlibs in target deps directory
2019-11-10 11:14:29 +07:00
bors
692b260c34
Auto merge of #4786 - msizanoen1:target-libs, r=Manishearth
...
Add the TARGET_LIBS environment variable for rustc CI testing
Needed to fix the test failure in rust-lang/rust#66158 .
See https://github.com/rust-lang/rust/pull/66158#issuecomment-550585396
r? @Manishearth
changelog: none
2019-11-08 22:58:33 +00:00
msizanoen1
7d2e813634
Add target libs directory to search path
2019-11-08 12:54:28 +07:00
Michael Wright
cc6e27fa71
Put ice test auxiliary fix in right place
2019-11-08 07:18:12 +02:00
Michael Wright
9c48a2c39a
Merge branch 'master' into fix-4727
2019-11-08 07:15:16 +02:00
bors
4be144af87
Auto merge of #4697 - Licenser:no-exit, r=flip1995
...
restriction lint for `std::process::exit`
Addition to #4655 - adds the lint checking for `std::process::exit`
changelog: add restriction lint for `std::process::exit`
2019-11-07 22:05:51 +00:00
Manish Goregaokar
4721f4419b
Remove clippy dependency in lint_without_lint_pass
2019-11-07 12:53:36 -08:00
Manish Goregaokar
fe90b82951
Remove clippy_lints from useless attribute test
2019-11-07 12:53:36 -08:00
Heinz N. Gies
5e6017d193
Update tests for exit
2019-11-07 17:11:06 +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
695aa59c6d
Add lint for exit
2019-11-07 17:10:18 +01:00
msizanoen1
52f9927ff5
Add the TARGET_LIBS environment variable for rustc CI testing
2019-11-07 22:48:14 +07: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
Michael Wright
e3c1aea157
use-self: correctly ignore dummy paths
2019-11-07 05:59:13 +02:00
Lzu Tao
fdc0153ef5
rustup improper_ctypes: extern "C"
fns
2019-11-07 00:49:33 +07:00
flip1995
073dbd4218
Add regression test for ICE #4775
2019-11-06 18:15:04 +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
a902e3fd71
rustup https://github.com/rust-lang/rust/pull/66014
2019-11-06 06:24:47 +00:00
Michael Wright
a952708b6c
Fix crash in use-self
lint
...
Fixes #4727
2019-11-06 07:33:56 +02:00
HMPerson1
e3d6069e18
Use correct TypeckTables when hashing bodies
2019-11-04 20:03:03 -05:00
Philipp Hansch
05aac0d8c1
UI test cleanup: Extract derive_hash_xor_eq tests
2019-10-28 07:34:29 +01:00
flip1995
4a52dd6c53
Rustup to rust-lang/rust#65773
2019-10-26 21:54:04 +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
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
Philipp Hansch
52f52900a4
Don't emit try_err lint in external macros
2019-10-24 07:52:01 +02:00
bors
87536f00e3
Auto merge of #4675 - lzutao:improve-shellscript, r=phansch
...
build: improve script and travis config
* fix a diff failure on windows
See https://travis-ci.com/rust-lang/rust-clippy/jobs/245971932#L1625
for an example.
* use cmp instead of diff > /dev/null
* clone single branch instead of clone then checking out
* do not decrypt key if have no diff change
changelog: none
2019-10-24 05:20:45 +00: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
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
b869eeb2a4
build: improve script and travis config
...
* fix a diff failure on windows
See https://travis-ci.com/rust-lang/rust-clippy/jobs/245971932#L1625
for an example.
* use cmp instead of diff > /dev/null
* clone single branch instead of clone then checking out
* do not decrypt key if have no diff change
2019-10-22 10:14:39 +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
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
HMPerson1
ffb53e7457
Add run-rustfix
to inefficient_to_string
2019-10-17 12:41:45 -04:00
HMPerson1
76b44f34b9
Add inefficient_to_string
lint
2019-10-16 15:54:20 -04:00
flip1995
2d6adb9424
Add regression test for ICE in use-self lint
2019-10-15 15:02:09 +02:00
James Wang
adf58868e9
Change terminology from static to associated
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
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
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
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
22f057972f
Match any expr for panic message
2019-10-07 20:40:05 +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
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
flip1995
c420b07191
Fix needless_pass_by_value
...
This also accidentally improved the spans of the suggestions
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
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
024dfee33c
Update unit_cmp tests to include blocks for asserts
2019-10-03 14:38:04 +02:00
Matthias Seiffert
320d17aa63
Update the .stderr to include the backticks
2019-10-03 12:01:02 +02:00
Shotaro Yamada
555f5a49a2
Test fixes
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
Lzu Tao
6b1a8683f4
Add suggestion for zero-ptr lint
2019-10-02 22:38:00 +07:00
flip1995
87db6bb1e3
Add regression test for ICE #4579
2019-10-02 09:39:04 +02:00
Manish Goregaokar
4318854bfc
Remove tests that only ICE on CI
2019-10-01 16:45:07 -07:00
Manish Goregaokar
f513aa3a05
Allow const_err in out_of_bounds_indexing tests
2019-10-01 16:37:22 -07:00
James Wang
189eaa54c6
Ignore impls derived from macros
2019-09-27 20:47:00 -05:00
flip1995
fff6b0e17c
Remove clippy::author attribute from trailing_zeroes test
2019-09-27 18:10:18 +02:00
flip1995
b67dfb4896
Move author issue test to author subdir
2019-09-27 18:07:07 +02: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 Sproul
4f9d6eea5c
Detect assignment ops in integer_arithmetic
2019-09-27 11:55:42 +10: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
5639639d35
Remove unused attribute in test
2019-09-26 01:53:39 +00:00
Lzu Tao
08ce6bc6d9
Fix macro expansion in toplevel_ref_arg lint
2019-09-26 08:46:51 +07:00
Lzu Tao
3b9e5dfda5
Add regression test for macro expansion
2019-09-26 08:14:58 +07:00
Manish Goregaokar
b94f2e89fd
unnecessary_operation: make test rustfixable
2019-09-25 14:45:18 -07:00
Manish Goregaokar
04dd580f37
unnecessary_clone: split rustfixable lint out into separate test
2019-09-25 14:45:18 -07:00
Manish Goregaokar
363e382f5b
string_add, string_add_assign: split tests, make one rustfixable
2019-09-25 14:45:18 -07:00
Manish Goregaokar
1a4dcfca35
redundant_static_lifetimes: split test, make rustfixable
2019-09-25 14:45:18 -07:00
Manish Goregaokar
ea16ab56d5
renamed_builtin_attr: make test rustfixable
2019-09-25 14:45:18 -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
e4ff86dcd4
map_unit_fn: make test rustfixable
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
24c283ea12
option_map_unit_fn: Split into fixable/unfixable
2019-09-25 14:45:18 -07:00
Manish Goregaokar
38a0785436
map_unit_fn: rename tests to fixable
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
a9a3350455
needless_return: add allow()s to test, make rustfixable
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
622b167eb8
needless_borrow: allow other lints, make fixable
2019-09-25 14:45:18 -07:00
Manish Goregaokar
0d8e4d7c37
mem_discriminant: split test, make rustfixable
2019-09-25 14:45:18 -07:00
Manish Goregaokar
483e140bce
map_flatten: make it a rustfix test
2019-09-25 14:45:18 -07:00
Manish Goregaokar
d29f6d28b5
Leave note on non-rustfixable tests
2019-09-25 14:45:18 -07:00
Manish Goregaokar
329e224eba
Remove large-digit-groups test from literals.rs
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
e2f4b60661
Split map_entry tests into fixable and unfixable
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
982c51e769
arm.pats -> arm.pat
2019-09-25 12:52:16 -07:00
Manish Goregaokar
68c26b325b
Rustup to rustc 1.39.0-nightly (acf7b50c7 2019-09-25)
...
- Addresses inference error
- Updates compiletest
2019-09-25 11:11:14 -07: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
Philipp Hansch
df83732f09
Add run-rustfix for toplevel_ref_arg lint
2019-09-23 11:22:31 +02:00
Michael Wright
ca6d36ba22
Merge branch 'master' into unneeded_wildcard_pattern
2019-09-23 05:26:47 +02:00
Matthias Krüger
d7b3e237db
rustup https://github.com/rust-lang/rust/pull/64666
2019-09-22 12:35:20 +02:00
Michael Wright
be4e41562a
Add additional tests to unneeded_wildcard_pattern
2019-09-22 09:10:39 +02:00
Michael Wright
d04bf15114
Merge branch 'master' into unneeded_wildcard_pattern
2019-09-22 08:59:23 +02:00
Philipp Hansch
afd7b180e5
Add run-rustfix for wildcard_enum_match_arm lint
2019-09-21 07:26:18 +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
2fecf756f7
inline_fn_without_body: make it use a rustfix page
2019-09-21 10:01:06 +09:00
Manish Goregaokar
ee9e1af4ed
implicit_return: make it use a rustfix test
2019-09-21 10:01:06 +09:00
Manish Goregaokar
a2ab0698cc
identity_conversion: make it use a rustfix test
2019-09-21 10:01:06 +09: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
38a34b1bd7
eq_op: stop testing nonminimal_bool in same file
2019-09-20 23:21:37 +09:00
Manish Goregaokar
49adc99aed
op_ref: Move tests out of eq_op file
2019-09-20 23:21:37 +09:00
Manish Goregaokar
d513a0b0a1
deref_addrof_double_trigger: Note why rustfix can't be used
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
flip1995
c3cfb77bc7
Add ICE regression test
2019-09-17 09:49:08 +02:00
Jason Olson
6f1f413717
Changes cast-lossless to a pedantic lint
...
Fixes #4528
2019-09-15 10:32:45 -07:00
bors
535bc1d704
Auto merge of #4513 - matthiaskrgr:dogdood_incrcomp, r=llogiq
...
tests: disable incremental compilation in dogfood to reduce target dir size
tests: execute dogfood tests with incremental compilation disabled reduces target/ dir size of when "cargo test"ing by around 2 gigs.
changelog: none
2019-09-14 16:02:59 +00:00
Michael Wright
67f149215f
Verify that issue #3567 is resolved
...
Closes #3567
2019-09-12 08:47:11 +02:00
Michael Wright
4a3bc6b592
Add unneeded-wildcard-pattern
lint
2019-09-12 08:25:05 +02:00
Matthias Krüger
a1ecf39442
tests: dogfood: run tests with debuginfo=0 reducing dogfood target dir size even further.
2019-09-11 21:29:07 +02:00
Matthias Krüger
34dc07863d
tests: execute dogfood tests with incremental compilation disabled
...
reduces target/ dir size of when "cago test"ing by around 2 gigs.
2019-09-11 21:29:00 +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
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
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
ca1c0aa819
Add a regression test for proc-macro attribute
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
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
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