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
Matthias Krüger
857c2c53bf
rustup https://github.com/rust-lang/rust/pull/60586
...
cc https://github.com/rust-lang/rust/issues/60623
2019-05-08 06:58:37 +02:00
Matthias Krüger
d618637c05
Rustup to rustc 1.36.0-nightly (13fde05b1 2019-05-03)
2019-05-03 22:28:34 -07:00
Jean Mertz
ff244b6c43
Fix link in into_iter_on_array documentation
...
The non-inline variant wasn't being rendered correctly.
see: https://rust-lang.github.io/rust-clippy/master/index.html#into_iter_on_array
2019-05-03 17:38:13 +02:00
bors
8b906f94f3
Auto merge of #4053 - euclio:too-many-args-span, r=flip1995
...
remove function body from "too many args" span
changelog: Remove the function body from the "too many arguments" span.
2019-05-03 07:26:55 +00:00
Andy Russell
9253506112
remove function body from "too many args" span
2019-05-02 10:36:59 -04:00
bors
8151a17422
Auto merge of #4049 - airt:fix-4033-search_is_some, r=flip1995
...
Fix #4033 search_is_some
Fixes #4033 .
Suggest `any(|x| ..)` instead of `any(|&x| ..)` for `find(|&x| ..).is_some()` (Lint [search_is_some](https://rust-lang.github.io/rust-clippy/master/index.html#search_is_some ))
FnDecl of `find`:
```rust
fn find<P>(&mut self, mut p: P) -> Option<Self::Item> where
P: FnMut(&Self::Item) -> bool
```
FnDecl of `any`:
```rust
fn any<F>(&mut self, mut f: F) -> bool where
F: FnMut(Self::Item) -> bool
```
If match on `|&_|` in closure of `find`, only use `|_|` in the suggestion.
PS. It's the first time that I have used the `hir` API, please correct me if there is any mistake 😺
2019-05-02 08:45:02 +00:00
bors
1cf5d7f04c
Auto merge of #4035 - JoshMcguigan:useless_let_if_seq-3043, r=oli-obk
...
useless_let_if_seq handle interior mutability
fixes #3043
This passes all tests, including a new one specifically dealing with a type with interior mutability. The main thing I'm unsure of is whether the span I used in the call to `is_freeze` is the most appropriate span to use, or if it matters.
2019-05-02 07:03:28 +00:00
Matthias Krüger
f195680edb
more Use->DropTemps fixes
2019-05-01 23:04:35 +02:00
Matthias Krüger
24e856f10a
rustup https://github.com/rust-lang/rust/pull/60417/
...
cc https://github.com/rust-lang/rust/issues/60448
2019-05-01 22:18:16 +02:00
Matthias Krüger
6967cf59a4
clippy-driver: use rustc_tools_util to get version info.
...
This will add git hash information to `clippy-driver -V` output.
2019-05-01 10:43:16 +02:00
airt
d063516c85
check closure arguments before use it
2019-05-01 04:41:00 +08:00
airt
5d6a100f81
format code
2019-05-01 04:03:51 +08:00
André Luis Leal Cardoso Junior
e428862c95
Update find(p).map(p) occurrences to use find_map(p)
2019-04-30 16:45:32 -03:00
André Luis Leal Cardoso Junior
b411391f8e
Add lints for find_map
2019-04-30 16:45:28 -03:00
airt
c3fde34fd5
fix suggestion for search_is_some
2019-05-01 03:11:58 +08:00
airt
bd0b75f6c3
fix suggestion for search_is_some naively
2019-05-01 01:08:16 +08:00
Manish Goregaokar
83519d3ca0
Rustup to rustc 1.36.0-nightly (f843ad60e 2019-04-30)
2019-04-29 22:31:39 -07:00
Manish Goregaokar
79f48d0573
Rustup to rustc 1.36.0-nightly (c7fcbfbf1 2019-04-29)
...
See https://github.com/rust-lang/rust/pull/60317
2019-04-28 22:42:16 -07:00
bors
78d13e007f
Auto merge of #4043 - rust-lang:map-clone-iter, r=matthiaskrgr
...
Suggest .copied() for map_clone on iterators too
fixes https://github.com/rust-lang/rust-clippy/issues/3958
changelog: Make `map_clone` suggest the newly-stable `Iterator::copied()` when applicable
r? @mikerite @matthiaskrgr
2019-04-28 18:39:00 +00:00
Manish Goregaokar
770de14505
Suggest .copied() for map_clone on iterators too
2019-04-28 11:14:39 -07:00
Matthias Krüger
e01caad2a8
deps: bump toml from 0.4 to 0.5
2019-04-28 19:24:36 +02:00
Michael Wright
5ad79c2b3d
Fix breakage due to rust-lang/rust#60225
2019-04-28 09:11:20 +02:00
Josh Mcguigan
2bbe8be8d0
useless_let_if_seq handle interior mutability
2019-04-25 19:07:01 -07:00
bors
910d538ef1
Auto merge of #4008 - g-bartoszek:boxed-fnmut, r=phansch
...
Do not trigger redundant_closure for non-function types
fixes #3898
Added a check for the entity being called in the closure body to be a FnDef. This way lint does not trigger for ADTs (Box) but I'm not sure if it's correct and not too restrictive.
<!--
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: Fix false positive in `redundant_closure` pertaining to non-function types
2019-04-25 18:13:47 +00:00
bors
6a0105e59f
Auto merge of #4026 - cemiloten:working-on-#3981, r=flip1995
...
Attempt to fix #3981
Fixes #3981
Hi, hopefully this is correct, happy to have feedback.
changelog: Don't trigger `unnecessary_cast` inside a macro
2019-04-25 10:37:30 +00:00
cemil
8eae2d3707
Ignore unnecessary cast if inside macro
2019-04-25 12:06:20 +02:00
bors
8c0e038f6f
Auto merge of #4029 - phansch:update_pulldown_cmark, r=oli-obk
...
Update pulldown_cmark to 0.5
We now no longer have to use our own wrapper around `Parser` and can use
the new `OffsetIter`.
changelog: none
2019-04-25 09:16:46 +00:00
Philipp Hansch
1f5a3c6e52
Rustup for https://github.com/rust-lang/rust/pull/59042
2019-04-25 07:29:23 +02:00
Philipp Hansch
32e877ce13
Update pulldown_cmark to 0.5
...
We now no longer have to use our own wrapper around `Parser` and can use
the new `OffsetIter`.
2019-04-24 22:54:12 +02:00
Matthew Kraai
5c7349d430
Remove approx_constant known problems
...
Fixes #4025 .
2019-04-24 09:29:45 -07:00
bors
253601a91c
Auto merge of #4024 - kraai:suppress-let_and_return-if-let-has-attributes, r=flip1995
...
Suppress let_and_return if let has attributes
Fixes #3882 .
changelog: suppress `let_and_return` if `let` has attributes
2019-04-24 07:29:35 +00:00
Matthew Kraai
c0479402e4
Suppress let_and_return if let has attributes
...
Fixes #3882 .
2019-04-23 23:32:16 -07:00
Matthew Kraai
9a43e09d77
Change "if types change" to "if you later change the type"
...
Fixes #3964 .
2019-04-23 16:53:09 -07:00
bors
9897442f27
Auto merge of #4018 - rust-lang:or_fn_call_variants, r=oli-obk
...
Ignore non-const ctor expressions in or_fn_call
Fixes https://github.com/rust-lang/rust-clippy/issues/1338
Should have been fixed by #919 , however that focuses on const ctor expressions only, and `.or(Some(local))` isn't const.
This also automatically ignores things like `.or(Some(local.clone())` which we don't actually want to do; I need to figure out what to do here.
changelog: Fixed false positive in [`or_fn_call`] pertaining to enum variant constructors
r? @oli-obk @phansch
2019-04-23 18:24:10 +00:00
Manish Goregaokar
f3455cda81
Rustup to rustc 1.36.0-nightly (fe0a415b4 2019-04-23)
2019-04-23 08:25:45 -07:00
Manish Goregaokar
7e2043de2f
Ignore all enum and struct constructors in lints about *or(call())
2019-04-23 08:01:42 -07:00
bors
d420589e1a
Auto merge of #4013 - kraai:move-path_buf_push_overwrite-to-nursery, r=matthiaskrgr
...
Move path_buf_push_overwrite to nursery
See #4012 .
changelog: move `path_buf_push_overwrite` to the nursery
2019-04-21 20:44:03 +00:00
Igor Matuszewski
930f1e6129
Use newly-introduced mutability query for statics
...
Fixes fallout from https://github.com/rust-lang/rust/pull/60124 .
cc https://github.com/rust-lang/rust/issues/60154
2019-04-21 21:15:34 +02:00
Matthew Kraai
4171299632
Move path_buf_push_overwrite to nursery
...
See #4012 .
2019-04-21 10:24:51 -07:00
Grzegorz
4f801a278d
redundant closure triggers for fnptrs and closures
2019-04-20 22:20:14 +02:00
bors
54e80c7b34
Auto merge of #4007 - phansch:fix_allowing_toplevel_ref_arg, r=flip1995
...
Allow allowing of toplevel_ref_arg lint
I'm not sure why some lints need the `HirId` to be able to recognize the
lint level attributes, but this commit makes the lint level attributes
work for `toplevel_ref_arg`.
Fixes #2332
changelog: Allow allowing of `toplevel_ref_arg` lint
2019-04-20 18:22:53 +00:00
bors
7a6d5c00d3
Auto merge of #4006 - phansch:fix_module_name_repetitions_fp, r=flip1995
...
Fix false positive in module_name_repetitions lint
This lint was triggering on modules inside expanded attrs, like
for example `#[cfg(test)]` and possibly more.
It was not reporting a location in #3892 because `span.lo()` and `span.hi()` both were 0.
Fixes #3892
changelog: Fix false positive in `module_name_repetitions` lint
2019-04-20 16:58:51 +00:00
Philipp Hansch
158aa39a7c
Allow allowing of toplevel_ref_arg lint
...
I'm not sure why some lints need the `HirId` to be able to recognize the
lint level attributes, but this commit makes the lint level attributes
work for `toplevel_ref_arg`.
2019-04-19 15:18:32 +02:00
Grzegorz
aa9cf07d56
redundant closure for functions restricted to FnDefs
2019-04-19 15:14:49 +02:00
Philipp Hansch
850c24edd3
Fix false positive in module_name_repetitions lint
...
This lint was triggering on modules inside expanded attrs, like
for example `#[cfg(test)]` and possibly more.
2019-04-19 12:53:03 +02:00
bors
12e8075d91
Auto merge of #3989 - flip1995:assert_on_const, r=phansch
...
Don't trigger assertions_on_constants on debug_assert!(false)
Fixes #3948
Fixes #3765
changelog: Fix `debug_assert!` false positive on `assertions_on_constants` lint
2019-04-19 09:57:35 +00:00
Felix Rabe
b4f2200d5c
Typo
2019-04-18 15:08:14 +02:00
flip1995
10cd28900f
Fix dogfood error
2019-04-18 13:37:20 +02:00
André Luis Leal Cardoso Junior
7e9cb5b84a
Add lint PathBufPushOverwrite
2019-04-18 08:05:55 -03:00
flip1995
834ad76806
Remove code duplication
2019-04-18 12:04:46 +02:00
flip1995
40218bae0c
Format code
2019-04-18 11:50:45 +02:00
flip1995
be98df5ac3
Don't lint debug_assert!(false)
2019-04-18 11:47:39 +02:00
bors
b834dbb2d5
Auto merge of #3984 - phansch:bytecount_sugg, r=flip1995
...
Change naive_bytecount applicability to MaybeIncorrect
We can't use `MachineApplicable` here as applying the fix will cause
another error because `bytecount` would first have to be added to the
Cargo.toml.
Example:
```
error: You appear to be counting bytes the naive way
--> $DIR/bytecount.rs:5:13
|
LL | let _ = x.iter().filter(|&&a| a == 0).count(); // naive byte count
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Consider using the bytecount crate: `bytecount::count(x, 0)`
```
Just replacing it with the suggestion is not enough.
cc #3630
2019-04-18 07:49:09 +00:00
Philipp Hansch
01ea9bd9d8
Change naive_bytecount applicability MaybeIncorrect
...
We can't use `MachineApplicable` here as applying the fix will cause
another error because `bytecount` would first have to be added to the
Cargo.toml.
2019-04-17 20:46:42 +02:00
Matthew Kraai
753c39672e
Use lint pass macros
...
Fixes #3917 .
2019-04-17 09:35:22 -07:00
flip1995
ce87051779
Fix lint_without_lint_pass internal lint
2019-04-17 06:51:21 -07:00
flip1995
840eac2c05
Use {get,match}_def_path from LateContext
2019-04-17 12:53:29 +02:00
flip1995
2f100e04af
Remove uplifted functions {get,match}_def_path from Clippy
2019-04-17 12:51:57 +02:00
bors
27d62cf603
Auto merge of #3966 - flip1995:internal_lints, r=oli-obk
...
Enable rustc internal lints
Closes #3965
I'm not 100% sure if enabling the `-Zunstable-options` flag in the `.cargo/config` file is the right place.
2019-04-17 04:46:19 +00:00
bors
1132caabff
Auto merge of #3975 - phansch:has_placeholders, r=flip1995
...
Change while_let_loop applicability to HasPlaceholders
The suggestion has been changed at some point to use `..` in the suggested code.
Due to that we can't make the lint MachineApplicable anymore.
cc #3630
2019-04-17 01:14:27 +00:00
Philipp Hansch
e974d84d03
while_let_loop uses placeholders in suggestions
...
Due to that we can't make the lint MachineApplicable anymore.
2019-04-16 20:05:16 +02:00
Manish Goregaokar
e9cde416ba
Only suggest .copied() for Option right now
2019-04-15 15:44:09 -07:00
Manish Goregaokar
ad2c65bd1b
Also suggest .copied() when .clone() is called on a Copy type
2019-04-15 14:39:41 -07:00
Manish Goregaokar
d2f7ae70ae
Suggest .copied() instead of .cloned() in map_clone when dealing with references
2019-04-15 14:32:39 -07:00
flip1995
445fa3b529
Deny rustc internal lints
2019-04-15 13:21:52 +02:00
flip1995
5361b842d1
Remove clippy::default_hash_types internal lint
2019-04-15 13:21:52 +02:00
Manish Goregaokar
2156f6733e
Clean up unused cx parameters
2019-04-14 13:23:43 -07:00
Manish Goregaokar
3c93a95b1f
HirIdify ReadVisitor
2019-04-14 13:18:34 -07:00
Manish Goregaokar
0c6956f8ce
Use _from_hir_id APIs
2019-04-14 13:15:20 -07:00
Manish Goregaokar
1b2f2be085
Remove now-unnecessary calls to node_to_hir_id
2019-04-14 13:11:31 -07:00
Philipp Hansch
289a9af801
cargo fmt
2019-04-14 15:07:15 +02:00
Philipp Hansch
ad27e3ff9b
Refactor suspicious_else_formatting using if_chain
2019-04-14 11:12:51 +02:00
Philipp Hansch
96c34e85c4
Remove except
in suspicious_else_formatting
...
This was causing two different ICEs in #3741 .
The first was fixed in #3925 .
The second one is fixed with this commit: We just don't `expect`
anymore. If the snippet doesn't contain an `else`, we stop emitting the
lint because it's not a suspiciously formatted else anyway.
2019-04-14 11:04:41 +02:00
bors
d516925ec8
Auto merge of #3946 - rchaser53:issue-3920, r=flip1995
...
fix format does not parse escaped braces error
related: https://github.com/rust-lang/rust-clippy/issues/3920
2019-04-12 17:03:01 +00:00
rchaser53
db6ca9b8d3
fix format does not parse escaped braces error
2019-04-13 01:39:10 +09:00
flip1995
3fe5eea4e4
Fix get_def_path
...
This fix is obsolet once rust-lang/rust#59779 and #3926 is merged.
2019-04-12 11:59:06 +02:00
bors
2278814c8e
Auto merge of #3931 - phansch:3891, r=flip1995
...
Fix ICE in decimal_literal_representation lint
Handling the integer parsing properly instead of just unwrapping.
Note that the test is not catching the ICE because plain UI tests
[currently hide ICEs][compiletest_issue]. Once that issue is fixed, this
test would fail properly again.
Fixes #3891
[compiletest_issue]: https://github.com/laumann/compiletest-rs/issues/169
2019-04-10 20:57:15 +00:00