Michael Wright
ea829bd8c6
Fix bad explicit_into_iter_loop
suggestion
...
Fixes #4958
2020-01-01 07:09:09 +02:00
Krishna Veera Reddy
84a60c3186
Prevent replace_consts
lint within match patterns
...
Currently `replace_consts` lint applies within match patterns but
the suggestion is incorrect as function calls are disallowed in
them. To fix this we prevent the lint from firing within patterns.
2019-12-31 10:33:15 -08:00
Krishna Veera Reddy
42e4595d3a
Indicate anonymous lifetimes for types
2019-12-31 09:22:35 -08:00
Krishna Veera Reddy
c09e79e226
Lint within internal macros without a suggestion
2019-12-31 09:22:35 -08:00
Krishna Veera Reddy
aa66f760c3
Destructure mem:replace
arguments
2019-12-31 09:22:35 -08:00
Krishna Veera Reddy
78b4dfc57c
Move mem_replace_with_default
out of nursery
2019-12-31 09:22:34 -08:00
Krishna Veera Reddy
26812f733d
Prevent mem_replace_with_default
lint within macros
...
Also added test cases for internal and external macros.
2019-12-31 09:22:34 -08: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
Yuki Okushi
f922812541
Fix ICE due to normalization failure
2019-12-31 20:55:11 +09:00
Yuki Okushi
bf08998b5c
Use is_empty()
2019-12-31 16:50:43 +09:00
Yuki Okushi
9086b17e14
Rustup to rust-lang/rust#67707
2019-12-31 09:17:56 +09:00
bors
3036b0e6d5
Auto merge of #4970 - krishna-veerareddy:fix-replace-consts-documentation, r=flip1995
...
Fix `replace_consts` lint documentation
`replace_consts` lint no longer lints for the usage of
`ATOMIC_{SIZE}_INIT` and `ONCE_INIT` so removing any
occurences of them in the documentation.
changelog: Update `replace_consts` lint documentation
2019-12-30 17:28:57 +00:00
bors
cecaca3382
Auto merge of #4634 - m-ober:feature/2320-map-or, r=llogiq
...
Add real suggestion to option_map_unwrap_or
changelog: Add real suggestion to `option_map_unwrap_or`
Fixes #2320
2019-12-30 15:50:06 +00:00
Krishna Veera Reddy
f533b98121
Fix replace_consts
lint documentation
...
`replace_consts` lint no longer lints for the usage of
`ATOMIC_{SIZE}_INIT` and `ONCE_INIT` so removing any
occurences of them in the documentation.
2019-12-30 05:55:22 -08:00
Yuki Okushi
a4c201e6b4
Rustup to rust-lang/rust#66942
2019-12-30 13:02:10 +09:00
Yuki Okushi
cf76eb48de
Rustup to rust-lang/rust#67151
2019-12-29 12:39:46 +09:00
Micha Ober
c5046fdce5
Add real suggestion to option_map_unwrap_or
2019-12-28 23:24:45 +01:00
bors
6bf87d5bbf
Auto merge of #4964 - JohnTitor:fix-potential-ice, r=flip1995
...
Possibly fix an ICE on test
Fix a potential ICE on test with debug assertion, caused on rust-lang/rust#67661 .
r? @oli-obk
changelog: none
2019-12-28 18:41:38 +00:00
mgr-inz-rafal
a208906afb
Fixes for elided lifetimes
2019-12-28 17:14:19 +01:00
mgr-inz-rafal
f191e916bd
Add new lint (modulo_arithmetic)
2019-12-28 16:46:08 +01:00
Yuki Okushi
bca125935c
code review
2019-12-28 22:45:41 +09:00
Yuki Okushi
fbdb13cfb0
Possibly fix an ICE on test
2019-12-28 22:30:44 +09:00
Yuki Okushi
5962fffcfe
Suggest similar lint name on unknown_clippy_lints
2019-12-27 22:07:55 +09:00
Yuki Okushi
e2636729ec
Rustup to rust-lang/rust#66936
2019-12-27 16:13:53 +09:00
bors
b0c4744d57
Auto merge of #4956 - JohnTitor:decimal-lit-suffix, r=llogiq
...
Do not drop suffixes on `decimal_literal_representation`
Fixes #4763
changelog: Do not drop type suffixes on `decimal_literal_representation`
2019-12-25 19:39:13 +00:00
Yuki Okushi
b68e65b4da
Do not drop suffixes on decimal_literal_representation
2019-12-26 01:22:36 +09:00
Yuki Okushi
ad936389e1
Correct documentation for len_zero
2019-12-25 21:06:55 +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
bors
40881e7713
Auto merge of #4941 - lzutao:utils-mod, r=phansch
...
a few small cleanups
changelog: none
2019-12-23 06:00:54 +00:00
Yuki Okushi
d5316163b6
Rustup to rust-lang/rust#66877
2019-12-23 09:07:46 +09: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
Mikhail Babenko
8b4a3b74e9
move is_must_use_ty to utils
2019-12-22 22:06:48 +03:00
flip1995
f6a5b608ef
Rustup to rust-lang/rust#66931
2019-12-22 15:56:34 +01:00
flip1995
9632e27487
Add <'_> where necessary
2019-12-22 15:42:41 +01: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
e5a5b0a077
rustup https://github.com/rust-lang/rust/pull/67455
2019-12-20 21:19:46 +01:00
bors
b4ad56e5c4
Auto merge of #4920 - lily-commure:fix-unnecessary-filter-map-docs, r=phansch
...
Fix documentation example for unnecessary_filter_map.
Fixes #4919 .
changelog: none
2019-12-20 07:27:24 +00: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
Emma
5a6b00ce50
Fix 'redudant' spelling in redundant_clone docs
...
The word 'redundant' is spelled incorrectly in the **What it does** section of the redundant_clone documentation.
2019-12-20 01:07:42 +01:00
Lily Chung
6e8c2bf8e6
Fix documentation example for unnecessary_filter_map.
2019-12-19 15:48:17 -08: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
mikerite
710e06dd29
Fix iterator_step_by_zero
description in declaration
...
Co-Authored-By: Phil Hansch <dev@phansch.net>
2019-12-19 06:51:26 +02:00
Michael Wright
38d0b2199a
Correct iterator_step_by_zero
documentation
2019-12-18 18:59:59 +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
460d5a3b5a
Prevent cmp_nan
when inside constants
...
`std::{f32,f64}::is_nan` isn't a const fn so prevent `cmp_nan`
lint from running within constant comparisons.
2019-12-17 19:18:42 -08: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
Krishna Veera Reddy
728a2418cb
Fix clippy build failure
...
Clippy build fails because the feature `result_map_or` has been
stabilized in v1.41.0 but we still have an explicit feature
attribute for it.
2019-12-16 22:29:05 -08: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
bors
221bf650f6
Auto merge of #4886 - rust-lang:must-use-pub-only, r=phansch
...
Lint only exported must_use_candidates
As promised on #4779 , here's the check for publicly visible items for `must_use_candidate`
changelog: none
2019-12-11 12:01:10 +00: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
Andre Bogus
a60177cc1e
Lint only exported must_use_candidates
2019-12-06 20:10:14 +01: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
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
c56f72da35
Make OP_REF lint suggestion MaybeIncorrect
...
cc #2597
2019-12-03 18:37:07 +01:00
Christopher Durham
718558064d
Fire clippy::op_ref on PartialOrd but !Ord types
2019-12-03 18:37:07 +01:00
flip1995
f6a75f17f6
Rustup to rust-lang/rust#66935
2019-12-03 18:37:06 +01:00
flip1995
aa2381d9d0
Fix rustdoc examples
2019-12-03 16:29:05 +01:00
flip1995
1e3b24de43
Make manual_swap autofixable
2019-12-03 13:42:05 +01:00
flip1995
bd39a608a8
Formatting
2019-12-03 13:25:41 +01:00
flip1995
d1d5f790f5
Fix FP in manual_swap lint with slice-like types
2019-12-03 13:25:41 +01:00
flip1995
286b39d2e5
Rustup to rust-lang/rust#64736
2019-12-02 20:39:40 +01:00
Philipp Hansch
474e9a131d
Use assert_crate_local for a more explicit error
...
`assert_crate_local` does the same as the previous `if let` but with a
more explicit error message if it's not a `ClearCrossCrate::Set`.
2019-12-02 12:09:38 +01:00
Philipp Hansch
6669c2c6ce
Rustup to https://github.com/rust-lang/rust/pull/66789
2019-12-02 09:51:35 +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
142b289a51
chore: fix and split some ui tests on 32bit system
2019-12-01 19:07:02 +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
c1ccba005f
fmt
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
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
bors
04036877ef
Auto merge of #4863 - phansch:use_self, r=flip1995
...
Move use_self to nursery
Closes #4859
We have a lot of false positives in this lint, so I think it makes sense
to move this to the nursery until they are resolved.
changelog: Move `use_self` lint to nursery, due to many false positives
2019-11-29 18:17:41 +00:00
flip1995
fd7eca2baf
Run update_lints
2019-11-29 14:50:19 +01:00
flip1995
604e6ba0e2
Add projections check to EUV for escape analysis
2019-11-29 12:57:10 +01:00
flip1995
b2523afae4
Use infer_ctxt
2019-11-29 11:12:19 +01:00
Philipp Hansch
70a2a29453
Move use_self to nursery
...
Closes #4859
We have a lot of false positives in this lint, so I think it makes sense
to move this to the nursery until they are resolved.
changelog: Move `use_self` lint to nursery, due to many false positives
2019-11-29 07:51:49 +01:00
Manish Goregaokar
45842e5131
Fix categorizations
2019-11-28 07:33:12 -08:00
Manish Goregaokar
c1c5c3522d
Fix arguments on ExprUseVisitor::new
2019-11-28 07:20:37 -08:00
Manish Goregaokar
dc9d839410
euv moved from middle to typeck
2019-11-28 07:17:56 -08:00
Manish Goregaokar
85bb66480c
cmt_ -> Place
2019-11-28 07:09:02 -08:00
bors
b5a6714155
Auto merge of #4849 - flip1995:deny_warnings, r=phansch
...
Deny warnings in CI
Removes the `debugging` feature, that wasn't used anymore and adds/enables the `deny-warnings` feature for every sub-crate of Clippy.
changelog: none
2019-11-28 10:27:46 +00: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
a05f3cb9a1
Rollup merge of #4847 - rust-lang:offest, r=phansch
...
fixing a typo
changelog: none
2019-11-28 10:19:06 +01: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
Phil Hansch
6686892cbf
Rollup merge of #4832 - dario23:i4829, r=phansch
...
Add some positive examples to lint docs
fixes #4829
changelog: Add some positive examples to lint docs
2019-11-28 10:19:04 +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
40c91ec758
config.usize_ty -> config.ptr_width
...
From http://github.com/rust-lang/rust/pull/66719
2019-11-27 15:09:48 -08:00
Manish Goregaokar
e381143a6b
More borrowkind fixes
2019-11-27 15:09:48 -08:00
Manish Goregaokar
3430bc1bc5
Re-add wildcards for BorrowKind in some places
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
Ian Kronquist
aef2662896
Update literal_representation.rs
2019-11-25 16:30:46 -08:00
Ian Kronquist
b13f4e4faf
Update literal_representation.rs
2019-11-25 16:28:46 -08:00
daxpedda
e46bedca3c
Remove negative float literal checks.
2019-11-25 19:23:28 +01:00
flip1995
1d3ec29880
Remove unused debugging feature
2019-11-25 17:23:07 +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
6eeac46b91
Run rustfmt
2019-11-25 15:20:10 +01:00
Andre Bogus
47ef5394de
fixing a typo
2019-11-25 14:06:34 +01: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
b4524004e0
Rollup merge of #4830 - lzutao:str-repeat, r=flip1995
...
use more efficient code to generate repeated string
see https://rust.godbolt.org/z/z9vrFP for comparison
changelog: none
2019-11-23 18:16:03 +01:00
Philipp Krones
ae69bc4980
Rollup merge of #4820 - guanqun:comment-fix, r=flip1995
...
doc: fix the comment above the lint function
it's a simple comment fix.
---
changelog: none
2019-11-23 18:16:01 +01: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
7cc8fa2e25
Fix fallout
2019-11-23 18:09:09 +01: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
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
e4636f3c39
Rustup to rust-lang/rust#66515
...
Fixes #4835
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
Johannes Schilling
c6e6b292bd
add a good example for the approx_const lint
2019-11-19 20:14:09 +01:00
Johannes Schilling
c58a5c6272
Add suggested good cases in docs for lifetimes lint
2019-11-19 20:03:41 +01:00
lzutao
d229d91d88
use usize::from
...
Co-Authored-By: Mateusz Mikuła <mati865@users.noreply.github.com>
2019-11-19 23:47:18 +07:00
Lzu Tao
4da0da9281
use more efficient code to generate repeated string
...
see https://rust.godbolt.org/z/z9vrFP for comparison
2019-11-19 23:08:50 +07: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
Guanqun Lu
f2d8197110
doc: fix the comment above the lint function
2019-11-16 01:55:06 +08:00
Florian Rohm
73806b72a9
register new lint "tabs in doc comments" and update readme
2019-11-15 16:26:30 +01:00
Florian Rohm
f8f7800b18
add new lint tabs in doc comments
2019-11-15 16:25:47 +01:00
Yuki Okushi
0736dd9dfe
Rustup rust-lang/rust#66233
2019-11-14 17:44:23 +09: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
2e9d173be1
literal representation restructure 12
...
Export function for formatting literals and remove crate visibility from
other items.
2019-11-13 08:28:50 +02:00
Michael Wright
eb9caf3050
literal representation restructure 11
...
Rename `grouping_hint` to `format` and use the term consistently.
2019-11-13 08:28:06 +02:00
Michael Wright
a8ca8a21c1
literal representation restructure 10
...
Rename DigitInfo to NumericLiteral
2019-11-13 08:28:01 +02:00
Michael Wright
a9c5a599e3
literal representation restructure 9
...
Only store valid suffixes (and not mistyped suffixes) in DigitInfo.
Check for mistyped suffixes later and not when DigitInfo is created.
This opens the door to more sophisticated mistyped suffix checks later.
2019-11-13 08:27:54 +02:00
Michael Wright
a58b980bd8
literal representation restructure 8
...
Store the digit parts directly in DigitInfo since we need them anyway.
2019-11-13 08:27:49 +02:00
Michael Wright
b62543f756
literal representation restructure 7
...
Replace `do_lint` with `get_group_size`. Return `None` if there are no
groups.
2019-11-13 08:27:42 +02:00
Michael Wright
abf62d8011
literal representation restructure 6
...
Add `group_digits` helper function.
2019-11-13 08:27:37 +02:00
Michael Wright
ec664e84bf
literal representation restructure 5
...
Use `split_digit_parts` in `check_lit`.
2019-11-13 08:27:27 +02: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
Michael Wright
2e8946a6de
literal representation restructure 3
...
Move suffix check into `check_lit` so that it isn't done repeatedly.
2019-11-13 08:27:14 +02:00
Michael Wright
2dbd34ffe8
literal representation restructure 2
...
Consolidate warning handling using "poor man's try".
2019-11-13 08:27:05 +02:00
Michael Wright
8f5b4f3f5c
literal representation restructure 1
...
Combine macro expansion checks. Indentation is a little strange to
avoid rustfmt issue.
2019-11-13 08:26:52 +02:00
Ian Kronquist
5c31efd429
Typo in literal_representation.rs
...
Octal numbers can't have 8 in them ;)
2019-11-12 16:02:02 -08: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
c1fd75005e
Fix breakage due to rust-lang/rust#65324
2019-11-11 06:22:50 +02:00
Michael Wright
89b966cdf1
Really fix to_digit_is_some
documentation
2019-11-10 18:00:04 +02:00
Michael Wright
9aefae4226
Fix to_digit_is_some
documentation
2019-11-10 17:58:17 +02:00
Michael Wright
a9b5b36769
Fix to_digit_is_some
dogfood errors
2019-11-10 15:53:08 +02:00
Michael Wright
5817a4fa06
Add to_digit_is_some
lint
2019-11-10 15:52:59 +02:00
Manish Goregaokar
3ef852b74c
Rustup to rustc 1.40.0-nightly (ac162c6ab 2019-11-09)
2019-11-09 17:04:42 -08:00
bors
b0b3dc6e76
Auto merge of #4776 - mikerite:fix-4727, r=flip1995
...
Fix crash in `use-self` lint
Fixes #4727
changelog: Fix crash in `use-self` lint
2019-11-08 22:06:21 +00:00
HMPerson1
94b36d9ca4
dogfood
2019-11-08 15:41:54 -05:00
HMPerson1
d4758420e6
Rustup rust-lang/rust#66188
2019-11-08 15:12:08 -05:00
Michael Wright
9c48a2c39a
Merge branch 'master' into fix-4727
2019-11-08 07:15:16 +02:00
Lzu Tao
ff5bf67b94
remove unused warnings
2019-11-08 10:23:42 +07:00
Lzu Tao
acbe224f6a
rustup https://github.com/rust-lang/rust/pull/65916
2019-11-08 10:23:42 +07: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
bors
426c05ae33
Auto merge of #4758 - mikerite:dec_lit_20191031, r=flip1995
...
`DecimalLiteralRepresentation` simplification
Remove recalculation of literal value.
changelog: none
2019-11-07 21:06:18 +00:00
bors
842cfb0311
Auto merge of #4757 - evanjs:issue/4748, r=phansch
...
Fix Deprecated lints don't expand
### Move doc comments inside of declare_deprecated_lint macros so that they are picked up by lintlib.py
### fixes #4748
Unable to `cargo test` locally (I'm on NixOS, and keep getting errors that are similar to those #4714 might solve) but I have verified that all deprecated lints can now be expanded like other lints.
![2019-10-30_21:06:28](https://user-images.githubusercontent.com/1847524/67910501-5815de00-fb59-11e9-9fa2-91fe6a8b9bb9.png )
changelog: Show deprecated lints in lint documentation again
2019-11-07 20:47:14 +00:00
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
BO41
43a2ba34e6
Add examples to some correctness lints
2019-08-22 15:41:07 +02:00
bors
57c67a29d2
Auto merge of #4352 - phansch:fix_redundant_pattern_matching, r=flip1995
...
Fix some suggestions for redundant_pattern_matching
.. and change the Applicability to `MaybeIncorrect`.
Fixes the problem displayed in https://github.com/rust-lang/rust-clippy/issues/4344#issuecomment-519206388 .
We now append `{}` to the suggestion so that the conditional has the
correct syntax again.
(If we were to _remove_ the `if` instead, it would trigger the
`unused_must_use` warning for `#[must_use]` types.)
changelog: Fix some suggestions for `redundant_pattern_matching`
2019-08-21 08:15:36 +00:00
Michael Wright
59893bcab0
Fix temporary_cstring_as_ptr
false negative
...
Fixes #4375 .
Changes the check to test when `.unwrap().as_ptr()` is called on any
`Result<CString, _>` as suggested by @flip1995
(https://github.com/rust-lang/rust-clippy/issues/4375#issuecomment-520724123 ).
2019-08-21 07:35:04 +02:00
Philipp Hansch
0d85d7e60f
Fix suggestions for redundant_pattern_matching
...
Fixes the problem displayed in https://github.com/rust-lang/rust-clippy/issues/4344#issuecomment-519206388 .
We now append `{}` to the suggestion so that the conditional has the
correct syntax again.
(If we were to _remove_ the `if` instead, it would trigger the
`unused_must_use` warning for `#[must_use]` types.
2019-08-21 07:29:44 +02:00
bors
835205b8da
Auto merge of #4401 - JJJollyjim:literal-separation-suggestion, r=flip1995
...
Add autofixable suggestion for unseparated integer literal suffixes
changelog: Add autofixable suggestion for unseparated integer literal suffixes
Somewhat WIP, since I haven't been able to get this working when adding `// run-rustfix` to `ui/literals.rs`. I think the issue is that there are multiple suggestions operating on one numerical literal, and I'm not sure what the best approach is to work around that.
Thanks
2019-08-20 07:54:25 +00:00
Philipp Hansch
1055cf5b9f
Merge pull request #4416 from SimonSapin/plugin
...
Import rustc_plugin from its new location
2019-08-20 07:28:59 +02:00
KRAAI, MATTHEW [VISUS]
eaf8f08390
Restore en dashes
2019-08-19 12:38:33 -07:00
KRAAI, MATTHEW [VISUS]
204b2f3658
Remove in_macro_or_desugar
2019-08-19 09:30:32 -07:00
Simon Sapin
08d8ffc6a9
Import rustc_plugin from its new location
...
Depends on https://github.com/rust-lang/rust/pull/62727
2019-08-19 17:52:10 +02:00
bors
5c71c1b838
Auto merge of #4411 - mikerite:fix-4384, r=flip1995
...
Fix `clone_on_copy` false positives
Closes #4384
changelog: Fix `clone_on_copy` false positives
2019-08-19 08:04:12 +00:00
bors
d1f1844f46
Auto merge of #4386 - lzutao:lint-option-and_then-some, r=flip1995
...
Add option_and_then_some lint
changelog: Add complexity lint to warn about `option.and_then(|o| Some(x))` and suggest replacing with `option.map(|o| x)`.
Closes #4299
2019-08-19 07:35:53 +00:00
Michael Wright
68a1af540c
Fix clone_on_copy
false positives
...
Closes #4384
2019-08-19 08:19:54 +02:00
Matthias Krüger
88f417e446
try to fix build in rustc repo
2019-08-19 06:10:00 +02:00
Lzu Tao
7065239da5
Add option_and_then_some lint
2019-08-19 03:54:40 +00:00
Jamie McClymont
4ee9d02efa
Requested changes
2019-08-19 14:20:38 +12:00
bors
f01a0c0e08
Auto merge of #4403 - xd009642:type_repetition_improvements, r=phansch,flip1995
...
Improvements to `type_repetition_in_bounds`
Improvements to the `type_repetition_in_bounds` trait based on feedback from #4380 #4326 #4323
Currently just make it pedantic. Hopefully, more to come
changelog: move `type_repetition_in_bounds` to `pedantic`
2019-08-18 21:03:21 +00:00
bors
6668e629ba
Auto merge of #4404 - BO41:patch-1, r=flip1995
...
Add "could be written as" example to MANUAL_MEMCPY
<!--
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 -->
changelog: none
2019-08-18 20:34:25 +00:00
xd009642
76598adafb
Run update_lints
2019-08-18 16:59:31 +01:00
Jeremy Stucki
9c39c02b75
Change lint type to 'complexity'
2019-08-18 16:49:11 +02:00
Jamie McClymont
c8fb62148e
Add autofixable suggestion for unseparated integer literal suffices
2019-08-19 02:46:12 +12:00
Jeremy Stucki
5df84f2192
Merge branch 'origin/master' into suspicious_map
2019-08-18 16:37:31 +02:00
Michael Wright
b313d25350
Fix breakage due to rust-lang/rust#61708
2019-08-18 13:14:47 +02:00
Lzu Tao
533bdfbdbc
Fix assertions_on_constants lint
2019-08-18 02:34:30 +07:00
Lzu Tao
439284b584
Make code cleaner and more readable
2019-08-18 01:47:45 +07:00
BO41
b17cb32bcb
Add "could be written as" example to MANUAL_MEMCPY
2019-08-17 13:09:03 +00:00
xd009642
c1e57402d3
Made lint pedantic
2019-08-17 11:45:05 +01:00
bors
49dff2c9f3
Auto merge of #4397 - kraai:remove-a, r=flip1995
...
Remove "a" from single_match_else description
changelog: none
2019-08-16 20:04:39 +00:00
flip1995
2456b355f2
Run rustfmt
2019-08-16 19:05:44 +02:00
KRAAI, MATTHEW [VISUS]
f74d9db7f4
Use outer_expn_data instead of outer_expn_info
2019-08-16 09:31:12 -07:00
KRAAI, MATTHEW [VISUS]
a68abc03a2
Remove "a" from single_match_else description
2019-08-16 05:41:35 -07:00
Lzu Tao
65b906a8fc
Rustup "Remove Spanned
from {ast,hir}::FieldPat
"
2019-08-16 09:32:27 +07:00
Jeremy Stucki
f4f31a4ff4
Implement lint 'suspicious_map'
2019-08-15 22:58:32 +02:00
flip1995
ebd3eeaede
Also specify patch version of toml crate
2019-08-15 15:58:36 +02:00
bors
607b8299c5
Auto merge of #4382 - jeremystucki:unnecessary_fold_span, r=flip1995
...
Change span of unnecessary_fold lint
Resolves #4381
changelog: Change linted span of `unnecessary_fold`
2019-08-15 12:57:51 +00:00
bors
a3da66d6d3
Auto merge of #4348 - phansch:deprecate-unused-unused-collect, r=flip1995
...
Deprecate unused_collect lint
I found this because we only had two test cases in total for this lint.
It turns out the functionality is fully covered by rustc these days.
[Playground Examples](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=eb8ee6db389c77180c9fb152d3c608f4 )
changelog: Deprecate `unused_collect` lint. This is fully covered by rustc's `#[must_use]` on `collect`
cc #2846
2019-08-15 10:47:20 +00:00
flip1995
9533fa5b19
Rustup to rust-lang/rust#63543
2019-08-15 10:14:06 +02:00
Philipp Hansch
42f03539ca
Deprecate unused_collect lint
...
I found this because we only had two test cases in total for this lint.
It turns out the functionality is fully covered by rustc these days.
[Playground Examples](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=eb8ee6db389c77180c9fb152d3c608f4 )
changelog: Deprecate `unused_collect` lint. This is fully covered by
rustc's `#[must_use]` on `collect`
cc #2846
2019-08-14 21:47:11 +02:00
Jeremy Stucki
fdf82eb1a8
Remove unused import
2019-08-14 20:24:05 +02:00
Jeremy Stucki
08f658bc72
Use different span
2019-08-14 19:35:06 +02:00
bors
dbe2bb4256
Auto merge of #4379 - matthiaskrgr:url_dep, r=phansch
...
update url dependency from 1.7.0 to 2.1.0
changelog: none
2019-08-14 13:07:19 +00:00
bors
06430e7af4
Auto merge of #4363 - phansch:fix_lint_deprecation, r=flip1995
...
Update lint deprecation for tool lints
changelog: Allow tool lints (`clippy::*`) to be deprecated
Our lint deprecation previously didn't work for tool lints, because
`register_removed` was registering lints to be removed _without_ the
`clippy` prefix.
Fixes #4349
2019-08-14 11:37:10 +00:00
Matthias Krüger
37d79d9a29
update url dependency from 1.7.0 to 2.1.0
2019-08-14 13:04:17 +02:00
bors
63d2d066f9
Auto merge of #4369 - mikerite:fix-4293, r=flip1995
...
Fix `wrong_self_convention` issue
Resolves #4293
changelog: Fix `wrong_self_convention` issue
2019-08-14 10:59:36 +00:00
Jeremy Stucki
2bfcf89f82
Merge branch 'origin/master' into flat-map
2019-08-14 07:36:37 +02:00
Jeremy Stucki
d578c43c51
Use correct span
2019-08-13 21:50:42 +02:00
Jeremy Stucki
4275d7b6ac
Run 'update_lints'
2019-08-12 21:47:12 +02:00
Jeremy Stucki
d51136d594
Use 'span_lint_and_sugg'
2019-08-12 21:42:57 +02:00
Jeremy Stucki
3a65e4e75a
Minor refactoring
2019-08-12 21:29:33 +02:00
Philipp Hansch
b50c13c578
Fix invalid_ref deprecation
2019-08-12 19:42:23 +02:00
Philipp Hansch
0b7e2376c8
Keep old deprecated lints deprecated as non-tool, too
2019-08-12 19:42:23 +02:00
Philipp Hansch
5114050839
Update lint deprecation for tool lints
...
Our lint deprecation previously didn't work for tool lints, because
`register_removed` was registering lints to be removed _without_ the
`clippy` prefix.
2019-08-12 19:20:36 +02:00
Jeremy Stucki
09e9568c26
Change lint type from 'pedantic' → 'complexity'
2019-08-12 10:53:23 +02:00
bors
e255f36afe
Auto merge of #4365 - lukas-code:async_new_ret_no_self, r=flip1995
...
new_ret_no_self: allow Self in inner type for impl Trait return types
Check the inner types of associated types of a trait when checking for Self in the return type of a `new` method. This means that the following will no longer warn:
```rust
trait Trait {
type Inner;
}
struct S;
impl S {
fn new() -> impl Trait<Inner = Option<Self>> {
struct TraitImpl;
impl Trait for TraitImpl {
type Inner = Option<S>;
}
TraitImpl
}
}
```
```rust
#![feature(async_await)]
struct Connection;
impl Connection {
async fn new() -> Result<Self, ()> {
Ok(S)
}
}
```
closes #4359
changelog: fix `new_ret_no_self` lint for async `new` functions.
2019-08-12 05:15:16 +00:00
Jeremy Stucki
df9063013e
Update rustdoc
2019-08-11 22:18:58 +02:00
Jeremy Stucki
5fd7d44f36
Refactor if_chain
...
Co-authored-by: Philipp Krones <hello@philkrones.com>
2019-08-11 21:02:01 +02:00
Jeremy Stucki
b651f19eb8
Rename 'flat_map' → 'flat_map_identity'
2019-08-11 20:34:25 +02:00
Jeremy Stucki
f0ce04f814
Handle calls with 'std::convert::identity'
2019-08-11 19:51:43 +02:00
Jeremy Stucki
05d9f884e1
Merge branch 'origin/master' into flat-map
2019-08-11 19:22:40 +02:00
Vallentin
b7460ad70b
Fixed repeated word
2019-08-11 12:56:30 +02:00
Ralf Jung
2dcce60fdc
deprecate invalid_ref lint
2019-08-11 09:31:55 +02:00
Michael Wright
77278ccda9
Fix wrong_self_convention
issue
...
Resolves #4293
2019-08-10 06:01:15 +02:00
Michael Wright
170d4861c6
Simplify wrong_self_convention
code
...
Use actual types instead of hir types.
2019-08-10 06:00:27 +02:00
Michael Wright
ebd24985bf
Rename implitem to impl_item
...
`impl_item` is proper snake case and used everywhere else.
2019-08-10 05:58:52 +02:00
Lukas Markeffsky
d7b9a845aa
new_ret_no_self: walk associated types in impl Trait return types
2019-08-09 17:44:05 +02:00
bors
c55d38ed7a
Auto merge of #4362 - lzutao:expect-on-cstring_as_ptr, r=flip1995
...
Fix lint_cstring_as_ptr for expect
Closes #4312
changelog: none
2019-08-09 09:22:02 +00:00
Lzu Tao
c23a5c586f
Fix lint_cstring_as_ptr for expect
2019-08-09 12:39:33 +07:00
Lzu Tao
30cbdc7491
Fix lint_single_char_pattern on raw string literal
2019-08-09 10:55:30 +07:00
bors
d23e6b396a
Auto merge of #4358 - lzutao:cleanup_implicit_return, r=flip1995
...
Use source_callsite() instead of recursive outer_expn_info()
changelog: none
2019-08-08 16:36:44 +00:00
bors
4465e2fbb8
Auto merge of #4355 - lzutao:macro_expn_try_err, r=flip1995
...
Fix macro expansion in try_err lint
Fixes #4309
changelog: none
2019-08-08 15:16:17 +00:00
Lzu Tao
59a35874c1
Use source_callsite() instead of recursive outer_expn_info()
2019-08-08 21:28:40 +07:00
Lzu Tao
90a7b60413
Use snippet_with_macro_callsite suggested by flip1995
2019-08-08 21:21:59 +07:00
Lzu Tao
0487b58f9a
Fix macro expansion in try_err lint
2019-08-08 20:22:52 +07:00
bors
286d528a45
Auto merge of #4345 - phansch:enum_variants_fix, r=flip1995
...
Don't emit enum_variant_names if remainder starts with a numeric
changelog: Fix false positive in `pub_enum_variant_names` and `enum_variant_names`
As [per the reference](https://doc.rust-lang.org/reference/identifiers.html ), identifiers must start with a letter. So we don't suggest a better
variant naming in case the remainder would start with a numeric.
Fixes #739
2019-08-07 10:22:06 +00:00
Philipp Hansch
0a988c6630
Don't emit enum_variant_names if remainder starts with a numeric
...
As [per the reference](https://doc.rust-lang.org/reference/identifiers.html ),
identifiers must start with a letter. So we don't suggest a better
variant naming in these cases.
Fixes #739
2019-08-06 20:45:36 +02:00
Lzu Tao
e4f8cd9672
Rustup https://github.com/rust-lang/rust/pull/59369
2019-08-06 19:20:41 +07:00
Philipp Hansch
cdfb72a5e1
fmt
2019-08-05 20:53:24 +02:00
Philipp Hansch
4cfb0966a1
Fix needless_bool suggestion with if-else-if-else
...
Closes #4334
2019-08-05 20:52:38 +02:00
Vincent Dal Maso
77b21b644f
Move expression check to LateLintPass
...
Changes:
- Move from EarlyLintPass
- Fix entrypoint check with function path def_id.
2019-08-05 13:23:30 +02:00
Vincent Dal Maso
4eab691db6
Add recursion check on main function
...
Changes:
- Add MainRecursion lint to clippy
- Check for no-std setup
fixes #333
2019-08-05 13:23:30 +02:00
bors
ca6a9beb31
Auto merge of #4338 - flip1995:rollup-9cm4jbr, r=flip1995
...
Rollup of 4 pull requests
Successful merges:
- #4329 (Doctests: Enable running doc tests for pedantic lints)
- #4330 (Doctests: Enable running doc tests for nursery lints)
- #4331 (Doctests: Enable running doc tests for restriction lints)
- #4332 (Split up cast.rs tests, run-rustfix for unnecessary_cast)
Failed merges:
r? @ghost
changelog: none
2019-08-05 09:44:45 +00:00
Philipp Krones
93c3da223f
Rollup merge of #4331 - phansch:doctests_restriction, r=flip1995
...
Doctests: Enable running doc tests for restriction lints
changelog: Enabled remaining doc tests for lint documentation page
master: 202 passed; 0 failed; 122 ignored; 0 measured; 0 filtered out
this PR: 231 passed; 0 failed; 123 ignored; 0 measured; 0 filtered out
Closes #4319 (assuming this is merged after #4329 and #4330 )
2019-08-05 10:50:06 +02:00
Philipp Krones
f5db24a59f
Rollup merge of #4330 - phansch:doctests_nursery, r=flip1995
...
Doctests: Enable running doc tests for nursery lints
changelog: none
master: 202 passed; 0 failed; 122 ignored; 0 measured; 0 filtered out
this PR: 213 passed; 0 failed; 122 ignored; 0 measured; 0 filtered out
cc #4319
2019-08-05 10:50:04 +02:00
Philipp Krones
713ad964af
Rollup merge of #4329 - phansch:doctests_pedantic, r=flip1995
...
Doctests: Enable running doc tests for pedantic lints
changelog: none
master: 202 passed; 0 failed; 122 ignored; 0 measured; 0 filtered out
this PR: 254 passed; 0 failed; 131 ignored; 0 measured; 0 filtered out
cc #4319
2019-08-05 10:50:03 +02:00
bors
a90b3ba301
Auto merge of #4337 - flip1995:let_unit, r=phansch
...
Make let_unit lint suggestion auto applicable
changelog: Make `let_unit` lint suggestion auto applicable
2019-08-05 08:41:24 +00:00
flip1995
c5ad0b075a
Make let_unit lint suggestion auto applicable
2019-08-05 09:31:08 +02:00
Philipp Hansch
71a943820b
Rustup to https://github.com/rust-lang/rust/pull/63213
2019-08-05 07:30:01 +02:00
Philipp Hansch
b608e02e1c
Doctests: Enable running doc tests for restriction lints
2019-08-03 21:24:50 +02:00
Philipp Hansch
2f48effc92
Doctests: Enable running doc tests for nursery lints
2019-08-03 21:01:23 +02:00
Philipp Hansch
1dc9a5012e
Doctests: Enable running doc tests for pedantic lints
2019-08-03 20:36:38 +02:00
bors
5c1e30ab05
Auto merge of #4327 - phansch:doctests_perf, r=flip1995
...
Doctests: Enable running doc tests for perf lints
changelog: none
This should be possible to merge independently of #4325
cc #4319
2019-08-03 14:06:13 +00:00
bors
3dc91838e4
Auto merge of #4325 - phansch:doctests_complexity, r=flip1995
...
Doctests: Enable running doc tests for complexity lints
changelog: none
master: `113 passed; 0 failed; 91 ignored; 0 measured; 0 filtered out`
this PR: `181 passed; 0 failed; 110 ignored; 0 measured; 0 filtered out`
cc #4319
2019-08-03 13:24:07 +00:00
Philipp Hansch
d61df4f609
Rustup to latest rustc master
...
Broken due to:
* https://github.com/rust-lang/rust/pull/63180 (`Existential` -> `OpaqueTy`)
* https://github.com/rust-lang/rust/pull/63121 (New fields for `FormatSpec`)
2019-08-03 08:44:32 +02:00
Philipp Hansch
eb68dc9a1a
Also enable doc tests for internal lints
...
Because there were fixed in the parent commit.
2019-08-03 08:12:53 +02:00
Philipp Hansch
c0cdfd296e
Doctests: Enable running doc tests for perf lints
...
This should be possible to merge independently of #4325
cc #4319
2019-08-03 08:08:00 +02:00
Philipp Hansch
abfa8a952c
Doctests: Fix all complexity lint docs
...
cc #4319
2019-08-02 18:16:35 +02:00
bors
d43ef7aa3f
Auto merge of #4322 - Y0hy0h:patch-1, r=phansch
...
Improve documentation on implicit_hasher lint
Provide an example of how to fix the implicit_hasher lint.
Fixes #3475 .
changelog: none
2019-08-01 18:58:11 +00:00
Y0hy0h
5decadd93e
Fix missing import
2019-08-01 17:54:22 +02:00
bors
18a7dce4da
Auto merge of #4314 - chansuke:add-negation-to-is_empty, r=flip1995
...
Add negation to `len_zero` lint to show more explicit message.
Fixes #4304 I have updated the `len_zero` to show the required negation in case of like the below case.
```
fn main() {
let v = vec![1];
if v.len() > 0 {
}
}
```
changelog: Clarify suggestion of `len_zero` lint.
2019-08-01 14:09:59 +00:00
flip1995
feca48d8a2
Fix doc tests
2019-08-01 15:14:06 +02:00
flip1995
7a73b8fdfa
Remove Known problems for UNNECESSARY_UNWRAP
...
This shouldn't happen with NLL
2019-08-01 15:14:06 +02:00
flip1995
e6a836e2e8
Move UNNECESSARY_UNWRAP to complexity and PANICKING_UNWRAP to correctness
2019-08-01 15:14:06 +02:00
bors
c8e5352d9b
Auto merge of #4318 - izik1:typo, r=phansch
...
Fix `for on` typo
<!--
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 `cargo fmt`
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 -->
closes #4317
changelog: minor typo fix
2019-08-01 09:20:32 +00:00
Y0hy0h
d7224a6341
Improve documentation on implicit_hasher lint
...
Provide an example of how to fix the lint.
2019-08-01 10:51:39 +02:00
bors
5d061d7058
Auto merge of #4315 - phansch:fn_to_numeric_cast_applicability, r=flip1995
...
Mark `fn_to_numeric_cast` lints as MaybeIncorrect
At least for now so that `cargo fix --clippy` is not causing problems
with this lint. See #3896 for the remaining problems with the suggestions of this lint.
changelog: none
cc #3630 , #3896
2019-08-01 07:59:51 +00:00
Zachery Gyurkovitz
b8a50cae4c
Fix for on
typo
2019-07-31 22:24:57 -07:00
Michael Wright
be646ac0df
Update formatting
2019-08-01 07:09:57 +02:00
Philipp Hansch
04ca58a691
Mark fn_to_numeric_cast
lints as MaybeIncorrect
...
At least for now so that `cargo fix --clippy` is not causing problems
with this lint.
cc #3630 , #3896
2019-07-31 21:05:31 +02:00
chansuke
2d467dca62
Add required negation in non_zero lint
2019-08-01 00:23:09 +09:00
Jakub Wieczorek
2a13e83f2b
Update all the code to pass the updated use_self
lint.
...
One struct required a temporary `#[allow(dead_code)]` annotation due to
a bug in the Rust compiler: https://github.com/rust-lang/rust/issues/63151 .
2019-07-31 08:50:43 +00:00
Jakub Wieczorek
41110b0039
Extend the use_self
lint to suggest uses of Self::Variant
.
2019-07-31 08:50:43 +00:00
bors
c3e913650e
Auto merge of #3766 - xd009642:issue-3764, r=flip1995
...
trait bounds lint - repeated types
This PR is to tackle https://github.com/rust-lang/rust-clippy/issues/3764 it's still a WIP and doesn't work but this is an initial stab. It builds though I haven't added any tests as I'm not sure where lint tests should go?
Unfortunately, it seems id isn't tied to the type itself but I guess where it is in the AST? Looking at https://manishearth.github.io/rust-internals-docs/syntax/ast/struct.Ty.html I can't see any members that would let me tell if a type was repeated in multiple trait bounds.
There may be other issues with how I've implemented this so any assistance is appreciated!
changelog: Add new lint: `type_repetition_in_bounds`
2019-07-30 12:11:17 +00:00
Michael Wright
2f5c1d031d
Fix breakage due to rust-lang/rust#61856
2019-07-30 06:39:51 +02:00
xd009642
78ebcaa526
Fix dogfood test
2019-07-28 09:31:05 +01:00
xd009642
03c543515a
Hash discriminant of lifetime.name
2019-07-27 23:04:36 +01:00
xd009642
ad637193f0
Hash discriminant of Lifetime::Name
2019-07-27 22:59:46 +01:00
xd009642
925e8207fa
Respond to review comments
...
Update README and CHANGELOG using the util scripts, refine the help message and fix the float_cmp error.
2019-07-27 21:58:29 +01:00
xd009642
5e9906b2c6
Added doc comment fixed type printout
...
Added a doc comment for the lint and fixed the printout of the type so it prints T not type(T)
2019-07-27 12:06:25 +01:00
xd009642
cac69ec063
Respond to comments and improve printout
...
Now get the trait names for the diagnostic message and removed more
`let c: fn(_) -> _ = T; hashes from hir_utils
2019-07-27 11:51:27 +01:00
Matthias Krüger
f195550148
rustup https://github.com/rust-lang/rust/pull/62964
2019-07-26 22:58:31 +02:00
xd009642
7853dac662
Responded to comments and fixed compile bug
...
Removed the hash of `let c: fn(_,_) -> _ = ExprKind::Cast` and
fixed compile issue by collecting HirVec into an actual Vec
2019-07-26 16:46:47 +01:00
xd009642
c0259179c3
Fixed more compile errors
...
Moved to rustc::hir::Ty
2019-07-24 22:59:32 +01:00
xd009642
792153104c
Fix some of the compile errors
2019-07-24 22:27:12 +01:00
xd009642
f3e4467c10
Changed Ty to ty, added lifetime 'tcx
2019-07-24 21:14:21 +01:00
xd009642
f71d59e6a6
Lint for type repetition in trait bounds.
...
This lint adds warning if types are redundantly repeated in trait bounds i.e. `T: Copy, T: Clone` instead of `T: Copy + Clone`. This is a late pass trait lint and has necessitated the addition of code to allow hashing of TyKinds without taking into account Span information.
2019-07-24 21:14:21 +01:00
Matthias Krüger
2221fc8124
rustup https://github.com/rust-lang/rust/pull/62859
2019-07-24 02:20:36 +02:00
bors
d71e9c4f10
Auto merge of #4266 - uHOOCCOOHu:fix/async_fn_lifetime, r=flip1995
...
Ignore generated fresh lifetimes in elision check
<!--
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 `cargo fmt`
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 -->
fixes #3988
changelog: Ignore generated fresh lifetimes in elision check.
**HELP**: It seems `tests/ui` are compiled under edition 2015, and I don't know how to add tests for this properly.
Here is the test input it had already passed:
```rust
#![feature(async_await)]
#![allow(dead_code)]
async fn sink1<'a>(_: &'a str) {} // lint
async fn sink1_elided(_: &str) {} // ok
async fn one_to_one<'a>(s: &'a str) -> &'a str { s } // lint
async fn one_to_one_elided(s: &str) -> &str { s } // ok
async fn all_to_one<'a>(a: &'a str, _b: &'a str) -> &'a str { a } // ok
// async fn unrelated(_: &str, _: &str) {} // Not allowed in async fn
// #3988
struct Foo;
impl Foo {
pub async fn foo(&mut self) {} // ok
}
// rust-lang/rust#61115
async fn print(s: &str) { // ok
println!("{}", s);
}
fn main() {}
```
2019-07-23 09:52:18 +00:00
Michael Wright
f05e295685
Fix breakage due to rust-lang/rust#60913
2019-07-21 12:52:14 +02:00
Michael Wright
67db88f645
Fix breakage due to rust-lang/rust#62705
...
Also rename `OUTER_EXPN_INFO` to `OUTER_EXPN_EXPN_INFO` to match new
function names.
2019-07-21 09:36:31 +02:00
Philipp Hansch
8dc6a462f8
Update pulldown-cmark to 0.5.3
2019-07-19 07:29:25 +02:00
bors
d509b5afef
Auto merge of #4274 - daxpedda:implicit_return_fixes, r=flip1995
...
false positives fixes of `implicit_return`
- Handle returning macro statements properly (remove "this error originates in a macro outside of the current crate")
- Handle functions that return never type
- Handle functions that panic but do not return never type
changelog: Fix false positives in `implicit_return` lint pertaining to macros and panics
2019-07-18 18:20:40 +00:00
flip1995
fc57b43f79
Format code
2019-07-18 17:23:22 +02:00
daxpedda
9e5e0f8f84
Improved imports
2019-07-17 20:44:09 +02:00
Darth-Revan
f0dc97965a
Corrections for PR review.
2019-07-17 08:58:36 +02:00
Darth-Revan
0513202d25
Implement lint for inherent to_string() method.
2019-07-17 08:58:32 +02:00
daxpedda
a2b63af746
Removed lintining on never type.
...
Abstracted repeating strings into statics.
2019-07-16 14:46:33 +02:00
Jerry Hardee
8a8eedf388
Lint
2019-07-15 14:00:07 -05:00
Jerry Hardee
8adbf7f2c1
Fix float_cmp false positive when comparing signum
...
f1.signum() == f2.signum()
f1.signum() != f2.signum()
should not trigger a warning.
2019-07-15 12:46:58 -05:00
daxpedda
6c067bf50e
false positives fixes of implicit_return
...
- Handle returning macro statements properly
- Handle functions that return never type
- Handle functions that panic but do not return never type
2019-07-15 16:02:50 +02:00
Michael Wright
b523d35d41
Deny warnings in CI
2019-07-15 07:35:02 +02:00
bors
10b915fa7e
Auto merge of #4268 - mikerite:fix-4260, r=flip1995
...
Fix bug in `implicit_hasher` causing crashes
Skip linting if the type is from an external macro. Closes #4260 .
changelog: Fix bug in `implicit_hasher` causing crashes
2019-07-13 08:59:12 +00:00
Lzu Tao
27c5348793
Rustup macro expansion and resolution
2019-07-12 00:26:36 +07:00
Michael Wright
de7749832c
Fix bug in implicit_hasher
causing crashes
...
Skip linting if the type is from an external macro. Closes #4260 .
2019-07-11 08:47:05 +02:00
uHOOCCOOHu
a9bec0c8a6
Ignore generated fresh lifetimes in elision check.
2019-07-10 01:57:25 +08:00
bors
032ae96856
Auto merge of #4257 - skade:improve-cast-alignment, r=flip1995
...
Improve cast_ptr_alignment lint
<!--
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)
- [x] `cargo test` passes locally
- [x] Executed `util/dev update_lints`
- [x] Added lint documentation
- [x] Run `cargo fmt`
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 -->
* print alignment in bytes in the lint message
* ignore ZST left-hand types
Fixes #3797 and #4256
changelog:
* `cast_ptr_alignment`: Print alignment in bytes in the lint message
* `cast_ptr_alignment`: Ignore casting from ZST left-hand types
2019-07-09 15:28:26 +00:00
Florian Gilcher
aa72cac87a
Improve cast_ptr_alignment lint
...
* print alignment in bytes in the lint message
* ignore ZST left-hand types
2019-07-09 17:02:26 +02:00
Vinzent Steinberg
f831b0979e
cast_ptr_alignment: Mention legal use under known problems
...
Refs #2881 .
2019-07-09 14:48:48 +02:00
bors
5c921a9f61
Auto merge of #4233 - thiagoarrais:jens1o-fix-1208, r=phansch,flip1995
...
Avoid reporting string_lit_as_bytes for long strings
Port of @jens1o code ([b76f939][jens1o_commit])
Fixes #1208
[jens1o_commit]: b76f939ac2
<!--
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 `cargo fmt`
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 -->
changelog: bugfix for long strings as bytes
2019-07-09 09:48:33 +00:00
Thiago Arrais
7d1a9447ea
Extract semantic constant
2019-07-08 17:51:13 -03:00
Bara
2fb73fe037
Use empty block instead of unit type for needless return
2019-07-08 20:45:51 +02:00
Jens Hausdorf
6d1aaac6c3
Avoid reporting string_lit_as_bytes for long strings
...
Port of @jens1o code ([b76f939][jens1o_commit])
Fixes #1208
[jens1o_commit]: b76f939ac2
Co-authored-by: Thiago Arrais <thiago.arrais@gmail.com>
2019-07-08 13:13:01 -03:00
Jeremy Stucki
c7da4c26fb
Implement flat_map lint
2019-07-08 17:11:54 +02:00
Michael Wright
c72be0f65a
rustfmt
2019-07-06 19:43:34 +02:00
Michael Wright
adcc02ed8a
Address reviews
2019-07-06 19:35:08 +02:00
Michael Wright
0579c3e0aa
Fix breakage due to rust-lang/rust#61988
2019-07-06 19:06:49 +02:00
Michael Wright
ce308910fd
Fix unknown lint warnings
2019-07-06 09:15:48 +02:00
Lzu Tao
481499101b
Remove lint for ONCE_INIT
...
ONCE_INIT will be deprecated in rust 1.38.0
2019-07-06 12:34:32 +07:00
Lzu Tao
7293defb34
Rename hir::map::local_def_id_from_hir_id to local_def_id
2019-07-06 10:52:51 +07:00
Michael Wright
c702a623a9
Remove unused import
2019-07-04 06:49:31 +02:00
Matthias Krüger
f18f81d6a6
rustup https://github.com/rust-lang/rust/pull/61995
2019-07-03 18:00:35 +02:00
Michael Wright
8fa023272f
Fix allow bug in trivially_copy_pass_by_ref
...
Closes #3992
2019-07-03 07:15:21 +02:00
Michael Wright
c199d9068e
Fix match_same_arms
false negative
...
Closes #4244
2019-07-02 08:18:55 +02:00
bors
47ada9ae07
Auto merge of #4243 - mikerite:fix-4058, r=flip1995
...
Fix `never_loop` false positive
Closes #4058
changelog: none
2019-07-01 08:10:25 +00:00
bors
ad638a3e42
Auto merge of #4222 - jfrikker:try_err, r=flip1995
...
Adding try_err lint
changelog: Adds the "try_err" lint, which catches instances of the following: Err(x)?
fixes #4212
2019-07-01 07:41:33 +00:00
Michael Wright
7c98915da9
Fix never_loop
false positive
...
Closes #4058
2019-07-01 07:22:04 +02:00
Manish Goregaokar
e3619a6507
fmt
2019-06-25 14:41:10 -07:00
Manish Goregaokar
4a6914bb8c
Remove a hir_to_node_id
2019-06-25 14:34:47 -07:00
Manish Goregaokar
d744dcdaaf
find_by_hir_id -> find
2019-06-25 14:34:07 -07:00
Manish Goregaokar
c47a7e4ef2
get_parent_node_by_hir_id -> get_parent_node
2019-06-25 14:33:51 -07:00
Joe Frikker
8880677b4f
Making try_err machine applicable
2019-06-24 21:28:46 -04:00
flip1995
662037bcf2
Simplify unsugar_if to just an if expr check
2019-06-24 09:51:53 +02:00
flip1995
c192c07930
Remove ast:: prefix from types
2019-06-24 09:40:11 +02:00
Mazdak Farrokhzad
46a0e54361
Put 'if let' back into comment.
2019-06-24 07:20:52 +02:00
Mazdak Farrokhzad
0373b007da
Pacify rustfmt.
2019-06-24 04:54:23 +02:00
Mazdak Farrokhzad
4434bfac01
Fix dogfood test failures.
2019-06-24 04:00:05 +02:00
Joe Frikker
1e6c6976dd
PR comments
2019-06-23 18:02:13 -04:00
Mazdak Farrokhzad
b918594369
Fix fallout from rust-lang/rust PR 60861.
2019-06-23 17:24:45 +02:00
Joe Frikker
60a80849ce
Adding try_err lint
2019-06-22 16:37:05 -04:00
bors
c5d1ecd474
Auto merge of #4220 - d-dorazio:4182-needless-return-void-functions, r=flip1995
...
make needless_return work with void functions
fixes https://github.com/rust-lang/rust-clippy/issues/4181 .
changelog: make needless_return work with void functions.
I don't think the failure is related to my changes, but I'm not sure 🤔
2019-06-22 09:38:53 +00:00
Lzu Tao
6aea41e050
Fix fallout cause NodeId pruning
2019-06-22 13:41:16 +07:00
Daniele D'Orazio
66dbc02b05
more idiomatic code
2019-06-21 14:46:34 +02:00
flip1995
6dc8084788
Remove another unnecessary lifetime
2019-06-21 14:41:52 +02:00
Jeremy Stucki
746fbad98a
Remove needless lifetimes
2019-06-21 14:41:19 +02:00
Daniele D'Orazio
e1a78ae528
update tests and fix lints in clippy
2019-06-21 14:17:59 +02:00
Daniele D'Orazio
6396a7a425
make needless_return work with void functions
2019-06-21 13:58:22 +02:00
flip1995
ca2ba973a7
Remove unnecssary lifetime from trait_ref_of_method
2019-06-21 12:32:39 +02:00
Michael Wright
837b5208f7
Fix breakage due to rust-lang/rust#61968
2019-06-21 08:14:07 +02:00
Lzu Tao
4fa498a3eb
Fix warnings about unnecessary lifetime bounds
...
Rustup https://github.com/rust-lang/rust/pull/61172
2019-06-20 01:36:23 +07:00
Lzu Tao
5e887b2a6a
Fix lifetime mismatch between LateContext and Ty
2019-06-19 17:21:53 +07:00
Lzu Tao
321779979a
Fix missing field in ExprKind::Yield
...
Rustup rust-lang/rust#61941
2019-06-19 16:59:25 +07:00
bors
97f8caabf6
Auto merge of #4210 - dtolnay:division, r=flip1995
...
Downgrade integer_division to restriction
I believe that this lint falls outside of the scope of opinionated pedantism of the other pedantic lints.
changelog: Downgrade integer_division lint from pedantic to restriction
2019-06-19 07:57:27 +00:00
Philipp Hansch
ebce573006
Refactor: Replace NodeSet with HirIdSet
...
This saves us one HirId -> NodeId conversion.
2019-06-18 19:45:01 +02:00
Matthias Krüger
4d984dc6e6
rustup https://github.com/rust-lang/rust/pull/61836/
2019-06-18 11:15:47 +02:00
Daniele D'Orazio
be14ea8c37
fix suggestion for floating points inequality
...
It should be of the form `(a - b).abs() > error` whereas it was
`(a - b).abs() < error` that is instead what should be used for equality.
2019-06-17 16:42:43 +02:00
David Tolnay
f88a387c3f
Downgrade integer_division to restriction
2019-06-15 00:17:04 -07:00
Lzu Tao
9bfdbd13c2
Fix wrong lifetime of TyCtxt
2019-06-14 23:47:48 +07:00
krk
fefa7e7f67
Register rename to the LintStore.
2019-06-14 10:45:03 +02:00
krk
55740219b0
Rename REDUNDANT_STATIC_LIFETIME to REDUNDANT_STATIC_LIFETIMES.
2019-06-14 10:45:03 +02:00
Kerem
3b1080542b
Remove pub from RedundantStaticLifetime.visit_type function.
...
Co-Authored-By: Philipp Krones <hello@philkrones.com>
2019-06-14 10:45:02 +02:00
krk
637e92d44e
Rename const_static_lifetime to redundant_static_lifetime.
2019-06-14 10:45:02 +02:00
krk
b38ce08e76
Merge StaticConst and StaticStatic lints into StaticConst.
2019-06-14 09:41:47 +02:00
krk
87e9dee884
Use RedundantStaticLifetime in StaticStatic.
2019-06-14 09:41:47 +02:00
krk
ff1b533c13
Move type-checking logic in StaticConst to RedundantStaticLifetime.
2019-06-14 09:41:46 +02:00
krk
16bd4796e9
Add lint for statics with explicit static lifetime.
2019-06-14 09:41:46 +02:00
bors
7b2a7a2257
Auto merge of #4201 - mgr-inz-rafal:typos_in_docs, r=matthiaskrgr
...
Typos and minor grammar corrections
Just some minor grammar issues and typos in documentation.
2019-06-13 05:01:02 +00:00
Lzu Tao
3832a8d253
Fix wrong lifetime of TyCtxt
2019-06-13 02:49:02 +07:00
mgr-inz-rafal
7ced26d863
Typos and minor grammar corrections
2019-06-12 20:07:10 +02:00
Thiago Arrais
b364eb7b54
Adds lint for integer division
2019-06-12 09:37:14 -03:00
Grzegorz
d4ad23bb3f
redundant_closure_for_method_calls fixes:
...
lint does not trigger when there is a difference in mutability
lint does not trigger when the method belongs to a trait which is not implemebted directly (Deref)
2019-06-12 13:43:36 +02:00
bors
bd33a97cc4
Auto merge of #4199 - flip1995:implicit_return_docs, r=flip1995
...
Fix implicit_return docs
Resolves #4197
changelog: none
2019-06-12 09:58:24 +00:00
flip1995
310c90abb8
Fix implicit_return docs
2019-06-12 10:51:14 +02:00
Matthias Krüger
7c91fb8ded
rustup https://github.com/rust-lang/rust/pull/61758/files
2019-06-12 10:28:58 +02:00
Lzu Tao
79e3c7cd55
Remove wrong lifetime from LintContext
2019-06-12 10:28:52 +02:00
bors
ba1702a05f
Auto merge of #4190 - projedi:fix-eta, r=flip1995
...
Fixing eta with respect to lazy evaluation.
This fixes #4187
changelog: `redundant_closure`: stop linting on expressions returning a function, which is then directly used by the closure
2019-06-10 19:03:18 +00:00
Alexander Shabalin
86bab94631
Fixing eta with respect to lazy evaluation.
2019-06-10 13:58:40 +03:00
Matthias Krüger
7d83e13660
rustup https://github.com/rust-lang/rust/pull/61669/
2019-06-09 15:21:28 +02:00
Michael Wright
b726b41daf
Add OUTER_EXPN_INFO lint
2019-06-08 13:35:04 +02:00
bors
71be6f62fa
Auto merge of #4177 - mikerite:compiler_lint_functions_fewer_strings, r=phansch
...
Remove `to_string()`s from CompilerLintFunctions
changelog: none
2019-06-06 10:25:13 +00:00
bors
5be4e71262
Auto merge of #4136 - euclio:println-writeln-suggestions, r=flip1995
...
add suggestions for print/write with newline lint
changelog: Add machine-applicable suggestions for `print!`/`write!` with newline lints.
2019-06-06 08:26:48 +00:00
Matthias Krüger
d0ca09883e
rustup https://github.com/rust-lang/rust/pull/57428/
2019-06-06 09:21:19 +02:00
Michael Wright
b36d7a0c61
Remove to_string()
s from CompilerLintFunctions
2019-06-06 07:12:12 +02:00
bors
42f96b2558
Auto merge of #4164 - mikerite:fix-4144, r=mikerite
...
Fix .map(..).unwrap_or_else(..) bad suggestion
Closes #4144
2019-06-04 06:28:23 +00:00
mikerite
3b7d6eeb4f
Fix comment grammar
...
Co-Authored-By: Philipp Krones <hello@philkrones.com>
2019-06-04 08:27:31 +02:00
bors
28a39e9741
Auto merge of #4165 - BO41:needless_range_loop, r=phansch
...
Add example to needless_range_loop
adds a "could be written as" example
btw, is it correct that the lint triggers even if the index is used not just for getting the values by index?
So that I have to add `.iter().enumerate()` to still get an index?
changelog: none
2019-06-03 08:28:15 +00:00
Lzu Tao
6c9ee51ecc
Bump cargo_metadata of clippy_lints
2019-06-03 09:13:33 +07:00
BO41
dd007e4477
Change from ignore to rust
2019-06-02 20:06:50 +02:00
Mateusz Mikuła
a3ace5c3ca
Cargo fmt
2019-06-02 18:58:11 +02:00
Mateusz Mikuła
9fefe36737
Rustup for https://github.com/rust-lang/rust/pull/61276
2019-06-02 18:30:40 +02:00
BO41
bd8f289247
Add example to needless_range_loop
2019-06-02 15:28:32 +02:00
Michael Wright
98585a0324
Fix .map(..).unwrap_or_else(..) bad suggestion
...
Closes #4144
2019-06-02 08:50:20 +02:00
Lzu Tao
f67c3e4b2a
Make use of new outer_expn_info()
function
2019-06-01 16:25:51 +07:00
Andy Russell
2d0c797da6
add suggestions for print/write with newline lint
2019-05-30 13:46:04 -04:00
bors
b1762e3e4a
Auto merge of #4157 - phansch:update_pulldown_cmark2, r=matthiaskrgr
...
Update pulldown_cmark to 0.5.2
Includes various parsing fixes. Most notably [this PR][pr]
changelog: none
[pr]: https://github.com/raphlinus/pulldown-cmark/pull/325
2019-05-30 12:07:48 +00:00
bors
0ab3f1762e
Auto merge of #4113 - rust-lang:author, r=flip1995
...
Fix `Block` dump in author lint
changelog: The `#[clippy::author]` attribute now emits correct pattern code for block expressions
2019-05-30 10:34:56 +00:00
Philipp Hansch
a34991228a
Update pulldown_cmark to 0.5.2
...
Includes various parsing fixes. Most notably [this PR][pr]
[pr]: https://github.com/raphlinus/pulldown-cmark/pull/325
2019-05-30 12:26:22 +02:00
bors
018fa30c56
Auto merge of #4153 - matthiaskrgr:rustup_5, r=flip1995
...
rustup https://github.com/rust-lang/rust/pull/60928
changelog: none
2019-05-29 20:01:57 +00:00
Matthias Krüger
22e77dfa98
rustup https://github.com/rust-lang/rust/pull/60928
2019-05-29 00:41:34 +02:00
Matthias Krüger
c9cc11e9fa
rustup https://github.com/rust-lang/rust/pull/61164
...
(which is included in https://github.com/rust-lang/rust/pull/61274 )
2019-05-28 20:47:16 +02:00
Oliver Scherer
f98e4bd33b
Fix Block
dump in author lint
2019-05-28 13:01:11 +02:00
bors
fb33fad08e
Auto merge of #4142 - agnxy:rename-assoc, r=flip1995
...
Rename "Associated*" to "Assoc*"
This is to fix the breakage introduced by rust-lang/rust#60163 .
changelog: none
2019-05-28 08:59:06 +00:00
bors
d57845ffdf
Auto merge of #4071 - matthiaskrgr:sizeof, r=flip1995
...
trivially_copy_pass_by_ref: print size of type and limit in the lint message
changelog: trivially_copy_pass_by_ref: print size of type and limit in the lint message
2019-05-28 07:56:04 +00:00
Oliver Scherer
73d1830812
Rustup to rustc 1.36.0-nightly (fa40a111f 2019-05-27)
2019-05-27 21:58:54 +02:00
bors
7b501f0f6a
Auto merge of #4137 - euclio:let-return, r=oli-obk
...
tweak `let_and_return` diagnostic
changelog: `let_and_return`: label the unnecessary let binding and convert the note to a structured
suggestion
2019-05-27 13:04:14 +00:00
bors
eb0a2884d2
Auto merge of #4149 - flip1995:rollup-6knpdqb, r=flip1995
...
Rollup of 2 pull requests
Successful merges:
- #4102 (Fix match_same_arms to fail late)
- #4119 (Improve non ascii literal)
Failed merges:
r? @ghost
2019-05-27 11:33:29 +00:00
Philipp Krones
dce670c73c
Rollup merge of #4119 - BO41:non_ascii_literal, r=flip1995
...
Improve non ascii literal
This PR improves the example of the [non_ascii_literal](https://rust-lang.github.io/rust-clippy/master/index.html#non_ascii_literal ) lint.
It also makes it auto-fixable.
Please review. This is my first PR to this project.
(Thanks @flip1995 for the help :)
changelog: none
fixes #4117
2019-05-27 13:09:17 +02:00
Philipp Krones
f0a767352b
Rollup merge of #4102 - Urriel:fix/4096_match_same_arms, r=flip1995
...
Fix match_same_arms to fail late
Changes:
- Add a function search_same_list which return a list of matched expressions
- Change the match_same_arms implementation behavior. It will lint each same arms found.
fixes #4096
changelog: none
2019-05-27 13:09:16 +02:00
bors
cf81a3b6d0
Auto merge of #3832 - HarrisonMc555:use_last, r=flip1995
...
Implement "Use last" lint
Closes #3673
This lint checks the use of `x.get(x.len() - 1)` and suggests `x.last()` (where `x` is a `Vec`).
There's at least one more thing that needs to happen here. I believe I am correctly checking most of the scenarios and avoiding false positives. However, if different `Vec`s are used for the `x.get` and `y.len`, then it will emit a false positive. In other words, I need to check to make sure the `Vec`s are the same.
Also, a lot of these commits were temporary and not helpful to the project history...am I supposed to squash on merge? If so, how do I do that?
changelog: New lint: `get_last_with_len`
2019-05-27 11:04:38 +00:00
Seo Sanghyeon
2c53a3f970
Fix typo in comment
2019-05-27 12:32:04 +09:00
Oliver Scherer
637e656451
Rustfmt
2019-05-26 17:36:21 +02:00
Oliver Scherer
fd2ecfcc89
Rustup to rustc 1.36.0-nightly (2268d9923 2019-05-26)
2019-05-26 16:47:26 +02:00
Andrew Xu
dcf064a4f9
Rename "Associated*" to "Assoc*"
...
This is to fix the breakage introduced by rust-lang/rust#60163 .
2019-05-25 20:31:34 +08:00
Philipp Hansch
a650659d63
Rustup to https://github.com/rust-lang/rust/pull/61026
2019-05-25 09:45:07 +02:00
Andy Russell
effea41fe4
tweak let_and_return
diagnostic
...
Label the unnecessary let binding and convert the note to structured
suggestion.
2019-05-24 14:52:55 -04:00
Matthias Krüger
c67d2b121a
rustup https://github.com/rust-lang/rust/pull/60803/
2019-05-24 15:25:36 +02:00
Philipp Hansch
aca56727db
Rustup to https://github.com/rust-lang/rust/pull/59545
2019-05-24 08:19:51 +02:00
Matthias Krüger
5d58163f7d
trivially_copy_pass_by_ref: print size of type and limit in the lint message
2019-05-23 23:48:20 +02:00
Philipp Hansch
7e9db162b5
Rollup merge of #4129 - matthiaskrgr:if_chain, r=phansch
...
update if_chain to 1.0.0
2019-05-23 21:28:49 +02:00
Philipp Hansch
a316179850
Rustup to https://github.com/rust-lang/rust/pull/60965
2019-05-23 20:19:00 +02:00
Matthias Krüger
655aef7c6c
update if_chain to 1.0.0
2019-05-23 17:23:59 +02:00
Philipp Hansch
edb698105f
cargo fmt
...
Roses are red
Violets are blue
`Add rustfmt to a pre-commit hook` is what I should do.
2019-05-23 07:24:53 +02:00
Philipp Hansch
635a2fa5df
Rustup to https://github.com/rust-lang/rust/pull/60740
...
changelog: none
2019-05-23 07:19:25 +02:00
Manish Goregaokar
a6cf35264f
Rustup to rustc 1.36.0-nightly (dbfe70dfc 2019-05-22)
2019-05-21 21:58:27 -07:00
Vincent Dal Maso
fa9f744c2c
Add the common case search
...
Changes:
- Refactor the common case search into a function.
- Fix the useless Option around the vec in the search_same_list.
2019-05-21 13:08:19 +02:00
Philipp Krones
42d849c185
Formatting inside if_chain! macro
2019-05-21 10:45:38 +02:00
Harrison McCullough
f32c2fcb7e
Implement get_last_with_len lint
2019-05-20 18:01:21 -06:00
BO41
36c8aaba8f
Fix tests and make other ascii lints auto-fixable
2019-05-20 16:02:50 +02:00
BO41
859b329603
Make non_ascii_literal auto-fixable
2019-05-20 15:23:38 +02:00
BO41
874de889dc
Improve verbosity of non_ascii_literal lint example
2019-05-20 15:08:53 +02:00
bors
fd56381015
Auto merge of #4088 - pJunger:check1, r=oli-obk
...
Added lint for TryFrom for checked integer conversion.
works towards #3947
Added lint for try_from for checked integer conversion.
Should recognize simple & straight-forward checked integer conversions.
2019-05-20 09:31:09 +00:00
bors
0417a0ac4d
Auto merge of #4107 - taiki-e:useless_attribute, r=flip1995
...
useless_attribute: Add unreachable_pub to whitelists
Fixes #4106
changelog: `useless_attribute`: whitelist `unreachable_pub` on `use` items
2019-05-19 10:37:09 +00:00
bors
4071b2996e
Auto merge of #4099 - flip1995:ul_4094, r=oli-obk
...
Add macro check for unreadable_literal lint
Closes #4094
changelog: Disable `unreadable_literal` lint inside macros
2019-05-19 08:46:43 +00:00
pJunger
f627fbdc59
Removed symbols again.
2019-05-18 10:54:03 +02:00
pJunger
7e0f2e3f1e
Removed unused lifetime.
2019-05-18 09:34:56 +02:00
pJunger
ce9494a3df
Changed impl to use symbols.
2019-05-18 09:34:56 +02:00
pJunger
00a5ef64a2
Added suggestion for conversion with is_ok.
2019-05-18 09:33:26 +02:00
pJunger
0a43dcfd04
Fixed more lint findings.
2019-05-18 09:33:26 +02:00
pJunger
1c86b3758d
Fixed clippy lints in checked_conversions.rs.
2019-05-18 09:33:26 +02:00
pJunger
14d948c560
Registered lint.
2019-05-18 09:33:25 +02:00
pJunger
47444c44ad
Added lint for TryFrom for checked integer conversion rust-lang#3947.
2019-05-18 09:33:25 +02:00
Taiki Endo
40fc725298
useless_attribute: Add unreachable_pub to whitelists
2019-05-18 14:22:16 +09:00
Oliver Scherer
f49ef0ec04
Dogfood
2019-05-18 01:42:15 +02:00
Oliver Scherer
462df72100
Dogfood and rustfmt
2019-05-18 00:58:25 +02:00
Oliver Scherer
f7f85a0dca
Prevent symbocalypse
2019-05-17 23:53:54 +02:00
Manish Goregaokar
ce63f3ae4d
Add known problems
2019-05-16 09:43:07 -07:00
Manish Goregaokar
373d270673
Rename to redundant_closure_for_method_calls
2019-05-16 09:18:50 -07:00
Vincent Dal Maso
902726c38d
Fix match_same_arms to fail late
...
Changes:
- Add a function search_same_list which return a list of matched expressions
- Change the match_same_arms implementation behaviour. It will lint each same arms found.
2019-05-16 11:27:45 +02:00
Michael Wright
4fcaab3d62
Split redundant_closure lint
...
Move the method checking into a new lint called
`redundant_closures_for_method_calls` and put it in the pedantic group.
This aspect of the lint seems more controversial than the rest.
cc #3942
2019-05-16 08:25:39 +02:00
flip1995
3543f58c84
Add macro check for unreadable_literal lint
...
Closes #4094
2019-05-15 14:57:56 +02:00
flip1995
5dea5d404c
Fix dogfood errors
2019-05-14 15:08:29 +02:00
flip1995
4b4d734758
Also hash mem::discriminant in hash_stmt
2019-05-14 14:13:23 +02:00
Oliver Scherer
f11b236087
mem::discriminant trumps manual discriminant hashing
2019-05-14 14:04:55 +02:00
Oliver Scherer
bc031d4c74
Properly hash enums
2019-05-14 13:57:48 +02:00
bors
501830bf01
Auto merge of #4084 - mikerite:fix-4019, r=oli-obk
...
Fix 4019
Fixes #4019
2019-05-14 11:26:16 +00:00
Oliver Scherer
dfbc74b08b
Rustfmt all the things
2019-05-14 10:33:48 +02:00
Oliver Scherer
af80c53450
Clippy dogfood
2019-05-14 10:33:48 +02:00
Oliver Scherer
b2dbda4d48
Use symbols instead of strings
2019-05-14 10:33:42 +02:00
Manish Goregaokar
42480fd031
Rustup to rustc 1.36.0-nightly (1764b2972 2019-05-12)
2019-05-13 11:39:14 -07:00
Michael Wright
2efd8c6e05
Fix comments; minor refactoring
2019-05-12 10:32:19 +02:00
Michael Wright
e6e3f24e0c
Fix #4019
2019-05-12 10:18:38 +02:00
Manish Goregaokar
abf6481f87
Add in_macro again
2019-05-11 21:39:37 -07:00
Manish Goregaokar
7eb8018554
Rename in_macro to in_macro_or_desugar
2019-05-11 21:39:02 -07:00
Manish Goregaokar
19cfb84405
Start handling desugarings in author lint
2019-05-10 23:43:58 -07:00
Manish Goregaokar
0499184201
Ignore desugarings in macro checks
2019-05-10 23:40:42 -07:00
Manish Goregaokar
5661e5947f
Add IfDesugar to desugaring_name
2019-05-10 23:40:42 -07:00
Manish Goregaokar
26ebc3e9a1
Fix consts.rs
2019-05-10 23:40:42 -07:00
Manish Goregaokar
c9ed92ce20
More uses of higher::if_block
2019-05-10 23:40:42 -07:00
Manish Goregaokar
69b1da4d82
Remove some unnecessary If arms
2019-05-10 23:40:42 -07:00
Manish Goregaokar
da8b56d99a
Fix needless_bool.rs
2019-05-10 23:40:42 -07:00
Manish Goregaokar
09a93291ec
Fix question_mark.rs
2019-05-10 23:40:42 -07:00
Manish Goregaokar
f40c77a776
Fix shadow.rs
2019-05-10 23:40:42 -07:00
Manish Goregaokar
62897747fd
Fix unwrap.rs
2019-05-10 23:40:42 -07:00
Manish Goregaokar
e7af60f258
Add util function for desugaring if block
2019-05-10 23:40:42 -07:00
Andy Russell
9ede56f383
use derive
feature over serde_derive
crate
2019-05-09 13:05:34 -04:00