mgr-inz-rafal
6223391170
Add tests for new lint (modulo_arithmetic)
2019-12-28 16:46:08 +01:00
Yuki Okushi
6e525fc7b1
Improve tests
2019-12-27 22:07:55 +09:00
Yuki Okushi
b68e65b4da
Do not drop suffixes on decimal_literal_representation
2019-12-26 01:22:36 +09:00
bors
a68ef55dbf
Auto merge of #4947 - rust-lang:doc-main-extern-crate, r=flip1995
...
Avoid needless_doctest_main on 'extern crate'
This fixes #4927 .
r? @flip1995
changelog: none
2019-12-24 15:03:54 +00: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
Andre Bogus
129d0cd0f4
Avoid needless_doctest_main on 'extern crate'
2019-12-24 13:42:37 +01:00
Lzu Tao
652666b288
rustup "Add span information to ExprKind::Assign
"
2019-12-24 11:25:24 +07:00
Lzu Tao
f5b896451a
do minor cleanups
...
* ToString and AsRef are in prelude, no need to import them
2019-12-24 03:06:52 +07:00
bors
37b7970a7c
Auto merge of #4934 - illicitonion:exhaustive_match, r=flip1995
...
Update wildcard enum match lint for non_exhaustive enums
changelog: wildcard_enum_match_arm gives better suggestions for non_exhaustive enums
2019-12-23 17:00:38 +00:00
bors
b38b026a98
Auto merge of #4823 - Areredify:must_use_res, r=flip1995
...
Add `let_underscore_must_use` lint
changelog: closes #4812 , added a new `let_underscore_must_use` lint, moved `is_must_use_ty` to utils, added `is_must_use_fn` util function
2019-12-23 06:16:37 +00:00
Lzu Tao
185e608ae2
a few small cleanups
2019-12-23 05:28:23 +07:00
Mikhail Babenko
a310cb2d0b
implemented let_underscore
lint
...
actually add files
update lints
change to pedantic
2019-12-22 22:10:25 +03:00
Daniel Wagner-Hall
4f4444c429
Remove trailling .s
2019-12-22 11:51:39 +00:00
bors
8723eb6035
Auto merge of #4937 - mikerite:fix-4824, r=phansch
...
Fix `map_clone` false positive
Don't lint when the item type is not a reference. `copied` only applies to references.
changelog: Fix `map_clone` false positive
2019-12-22 09:55:50 +00:00
bors
19dbb22032
Auto merge of #4930 - flip1995:unused_label, r=phansch
...
Deprecate unused_label lint
This lint was uplifted/turned into warn-by-default in rustc
Fixes #4925
changelog: Deprecate [`unused_label`] lint
2019-12-22 09:39:32 +00:00
Michael Wright
b15b977d76
Fix map_clone
false positive
...
Don't lint when the item type is not a reference. `copied` only applies
to references.
2019-12-22 11:26:51 +02:00
Daniel Wagner-Hall
c21b4ad7d4
Update wildcard enum match lint for non_exhaustive enums
2019-12-22 02:13:39 +00:00
Krishna Veera Reddy
91a491e68e
Reduce cognitive complexity lint span
...
Currently the cognitive complexity lint spans the entire function
body making it really difficult to read and refactor the code in
editors. To fix this we reduce the lint span to the function name.
2019-12-21 18:07:53 -08:00
Lzu Tao
d1ca5f1d7c
rustup "Merge ast::Mutability
and mir::Mutability
"
2019-12-21 18:38:45 +00:00
flip1995
710c749bb1
Deprecate unused_label lint
...
This lint was uplifted/turned into warn-by-default in rustc
2019-12-21 16:20:30 +01:00
Matthias Krüger
907078a8f8
rustup https://github.com/rust-lang/rust/pull/67130
2019-12-21 15:13:22 +01:00
bors
a86463c99f
Auto merge of #4913 - mikerite:step-by-zero-20191218, r=phansch
...
Move `iterator_step_by_zero` and correct the documentation
Move `iterator_step_by_zero` and correct the documentation.
changelog: Corrected `iterator_step_by_zero` documentation
2019-12-20 07:10:11 +00:00
bors
584f95fc54
Auto merge of #4915 - mikerite:fix-4912-2, r=phansch
...
Fix `expect_fun_call` false negative on references
Closes #4912
changelog: Fix `expect_fun_call` false negative on references
2019-12-19 09:44:14 +00:00
Michael Wright
1559f8bf34
Fix expect_fun_call
false negative on references
...
Closes #4912
2019-12-19 06:57:56 +02:00
Michael Wright
e097fca4df
Update iterator_step_by_zero
...
Move `iterator_step_by_zero` into `methods` since it applies to all
iterators and not just ranges. Simplify the code while doing so.
2019-12-18 18:59:43 +02:00
Krishna Veera Reddy
eb0408ea65
Detect comparisons with NAN constants
...
Currently `cmp_nan` lint doesn't detect comparisons with NaN's
if the operands are consts variables so to fix this we evaluate
the const variables first before testing for NaN.
2019-12-17 18:51:30 -08:00
Mark Rousskov
69f99e74ac
Update tests for revert of never type stabilization
2019-12-14 08:40:43 -05:00
bors
d82debbd01
Auto merge of #4883 - krishna-veerareddy:issue-4818-cast-sign-loss-false-positive, r=flip1995
...
Fix false positive with cast_sign_loss lint
`cast_sign_loss` lint incorrectly suggests that the result of `checked_abs`, `rem_euclid` and `checked_rem_euclid` cannot be casted to an unsigned integer without loss.
Fixes #4818 #4764 #4743
changelog: Fix false positives in `cast_sign_loss` lint
2019-12-12 00:34:59 +00:00
Krishna Veera Reddy
23c03e4994
Move transmute_float_to_int
test cases into separate file
...
`transmute.stderr` file line count exceeded due to the new test
cases so moving the new test cases into a separate file.
2019-12-07 17:19:56 -08: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
Krishna Veera Reddy
c0fb74baf5
Add widening tests for cast_sign_loss
lint
2019-12-05 17:18:27 -08:00
Krishna Veera Reddy
7002a9ee83
Fix false positive with cast_sign_loss lint
...
`cast_sign_loss` lint incorrectly suggests that the result of
`checked_abs`, `rem_euclid` and `checked_rem_euclid` cannot
be casted to an unsigned integer without loss.
2019-12-05 15:47:15 -08:00
daxpedda
946961d19e
Change to only detect in external macros.
2019-12-05 11:06:13 +01:00
daxpedda
d11b958faf
Fix false positive in string_add
.
2019-12-04 21:51:02 +01:00
Matthias Krüger
98e433d70d
Rustup to rust-lang/rust#66878
2019-12-04 01:34:01 +01:00
bors
c66cca44c8
Auto merge of #4877 - flip1995:manual_swap_4853, r=llogiq
...
Fix FP in manual_swap lint with slice-like types
Fixes #4853
changelog: Fix FP in [`manual_swap`] lint with slice-like types and make it auto applicable
2019-12-03 18:36:19 +00:00
flip1995
7162393103
Update op_ref.stderr
2019-12-03 18:37:07 +01:00
flip1995
1e3b24de43
Make manual_swap autofixable
2019-12-03 13:42:05 +01:00
flip1995
d3232b0fce
Add regression test for manual_swap
2019-12-03 13:25:41 +01:00
flip1995
511deceb36
Normalize custom ICE test
...
Fixes #4872
2019-12-02 20:42:39 +01:00
bors
45196cee02
Auto merge of #4690 - lzutao:fix-test-on-non-amd64, r=flip1995
...
generate stderr file on 32bit pointer system
changelog: none
2019-12-01 18:39:21 +00:00
Lzu Tao
5488672d1f
account for external macro in MISSING_INLINE_IN_PUBLIC_ITEMS lint
2019-12-01 19:38:01 +07:00
Lzu Tao
7156aa7f95
build(tests/fmt): use shared target dir
2019-12-01 19:07:02 +07:00
Lzu Tao
142b289a51
chore: fix and split some ui tests on 32bit system
2019-12-01 19:07:02 +07:00
Lzu Tao
83b90d8a86
remove needless my_lint ui test
2019-12-01 09:56:47 +07:00
Andre Bogus
ef7587d957
Less needless_doctest_main false positives
...
This checks if a) the `fn main() {}` function is empty or if the doctest contains a `static`. In both cases don't lint.
2019-11-29 21:47:26 +01:00
Philipp Hansch
21dee8f529
Use rustc_env instead of exec_env for test
2019-11-29 20:47:50 +01:00
Philipp Hansch
ad6d8a4700
Make triggering this lint less likely 📎
2019-11-29 20:47:50 +01:00
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