Commit graph

11529 commits

Author SHA1 Message Date
Cameron Steffen 857d9f15da Fix error punctuation 2021-05-02 16:56:46 -05:00
Cameron Steffen 1e22e564e4 Refactor config deserialization 2021-05-01 17:38:05 -05:00
Cameron Steffen b9c8e683d6 Disable default_trait_access in macros 2021-05-01 16:16:32 -05:00
bors 841244dff0 Auto merge of #7146 - mgacek8:mgacek8-small-fix, r=flip1995
Small fix in CONTRIBUTING.md

This is a section for `IntelliJ Rust`, not `rust-analyzer`.
changelog: none
2021-04-30 15:39:09 +00:00
Mateusz Gacek a7dc1ca80a
Small fix in CONTRIBUTING.md 2021-04-30 17:27:42 +02:00
bors a300b0e66c Auto merge of #7144 - rust-lang:while_immutable_mut_cond, r=flip1995
while_immutable_cond: check condition for mutation

This fixes #6689 by also checking the bindings mutated in the condition, whereas it was previously only checked in the loop body.

---

changelog: Fix FP in [`while_immutable_cond`] where mutation in the loop variable wasn't picked up.
2021-04-30 15:08:27 +00:00
bors 5e49c4bd67 Auto merge of #6951 - Jarcho:implicit_return_fp, r=flip1995
`implicit_return` improvements

fixes: #6940

changelog: Fix `implicit_return` suggestion for async functions
changelog: Improve `implicit_return` suggestions when returning the result of a macro
changelog: Check for `break` expressions inside a loop which are then implicitly returned
changelog: Allow all diverging functions in `implicit_return`, not just panic functions
2021-04-30 14:55:56 +00:00
bors 14f1551075 Auto merge of #7118 - TaKO8Ki:fix-false-positive-in-comparison-chain, r=giraffate
Fix a false-positive inside const fn in `comparison_chain`

closes https://github.com/rust-lang/rust-clippy/issues/7082

changelog: fix a false-positive inside const fn in [`comparison_chain`]
2021-04-30 06:30:38 +00:00
Takayuki 0dff377a62 use in_constant 2021-04-30 14:40:35 +09:00
bors a55912c48e Auto merge of #7141 - camsteffen:conf-file, r=flip1995
Remove leftover plugin conf_file code

changelog: none

Removes dead code that used to support the following syntax:

```rust
#![plugin(clippy(conf_file="path/to/clippy's/configuration"))]
```

RLS (and others?) will need to remove the `&[]` from `clippy_lints::read_conf(&[], sess)`.

r? `@flip1995`
2021-04-29 14:57:24 +00:00
Andre Bogus 63425de77d while_immutable_cond: check condition for mutation 2021-04-29 10:10:58 +02:00
Cameron Steffen 32351d6b9f Remove leftover plugin conf_file code 2021-04-28 16:04:59 -05:00
bors ce37099bd3 Auto merge of #7140 - matthiaskrgr:ice_std, r=llogiq
fix ice when checking rustc libstd

```
thread 'rustc' panicked at 'index out of bounds: the len is 0 but the index is 0', src/tools/clippy/clippy_lints/src/matches.rs:1595:53
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```

I don't have a minimised testcase because I don't have time to reduce libstd down to a few lines right now.

---
changelog: fix index out of bounds access when checking rustc libstd
2021-04-27 23:39:41 +00:00
Matthias Krüger 572c405da0 fix ice when checking rustc libstd
thread 'rustc' panicked at 'index out of bounds: the len is 0 but the index is 0', src/tools/clippy/clippy_lints/src/matches.rs:1595:53
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

I don't have a minimised testcase because I don't have time to reduce libstd down to a few lines right now.
2021-04-27 23:16:19 +02:00
bors 7c7683c8ef Auto merge of #7128 - Jarcho:const_fn_ice, r=flip1995
Fix ICE checking for feature gated const fn

fixes: #7126
changelog: Fix ICE in `missing_const_for_fn` when using a feature-gated `const fn`
2021-04-27 14:21:11 +00:00
bors 9af07e65aa Auto merge of #7138 - mgacek8:issue6808_iter_cloned_collect_FN_with_large_array, r=Manishearth
Fix FN in `iter_cloned_collect` with a large array

fixes #6808
changelog: Fix FN in `iter_cloned_collect` with a large array

I spotted that [is_iterable_array](a362a4d1d0/clippy_lints/src/loops/explicit_iter_loop.rs (L67-L75)) function that `explicit_iter_loop` lint is using only works for array sizes <= 32.
There is this comment:
> IntoIterator is currently only implemented for array sizes <= 32 in rustc

I'm a bit confused, because I read that [IntoIterator for arrays](https://doc.rust-lang.org/src/core/array/mod.rs.html#194-201) with const generic `N` is stable since = "1.0.0". Although Const Generics MVP were stabilized in Rust 1.51.

Should I set MSRV for the current change? I will try to test with older compilers soon.
2021-04-27 13:44:51 +00:00
bors 0a330e6824 Auto merge of #7136 - mgacek8:issue6965_manual_unwrap_or_invalid_sugg_macro_expansion, r=llogiq
manual_unwrap_or: fix invalid code suggestion, due to macro expansion

fixes #6965

changelog: fix invalid code suggestion in `manual_unwrap_or` lint, due to macro expansion
2021-04-26 21:39:40 +00:00
bors f33d86df4e Auto merge of #7137 - camsteffen:msrv-mod, r=llogiq
Refactor MSRV aliases

changelog: Remove MSRV from `needless_question_mark` and change MSRV for `missing_const_for_fn` from 1.37.0 to 1.46.0.

First [mentioned on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/Better.20MSRV.20testing.20idea/near/236215074).

* Moves MSRV constants into `clippy_utils::msrvs`. Now they are named to represent a stabilized feature flag or library item that is required for a lint's suggestion.
* `needless_question_mark` no longer has MSRV. Not needed since it does not suggest adding `?`.
* `missing_const_for_fn` MSRV was changed from 1.37.0 to 1.46.0. This seems to be a past mistake.
2021-04-26 21:25:19 +00:00
Cameron Steffen 3a8e759d8a Update MSRV contribution docs 2021-04-26 16:07:48 -05:00
Cameron Steffen 340b570ea0 Refactor MSRV aliases 2021-04-26 16:07:48 -05:00
Cameron Steffen 33ed8b5b24 Remove needless_question_mark MSRV 2021-04-26 16:02:11 -05:00
Mateusz Gacek d7627dcfc8 Fix FN in iter_cloned_collect with a large array 2021-04-26 13:03:51 -07:00
Mateusz Gacek 84003aa7a1 fix invalid code suggestion in manual_unwrap_or, due to macro expansion 2021-04-26 12:19:23 -07:00
bors a362a4d1d0 Auto merge of #7134 - camsteffen:copied-msrv, r=Manishearth
Finish MSRV for cloned_instead_of_copied

changelog: none

r? `@Manishearth`
2021-04-26 16:12:04 +00:00
Cameron Steffen dcf4e07458 Finish MSRV for cloned_instead_of_copied 2021-04-26 11:09:24 -05:00
bors 1bb3b12dfb Auto merge of #7132 - rust-lang:single_element_loop_iter, r=Manishearth
extend `single_element_loop` to match `.iter()`

This extends `single_element_loop` to also match `[..].iter()` in the loop argument. Related to #7125, but not completely fixing it due to the lint only firing if the array expression contains a local variable.

---

changelog: none
2021-04-26 14:28:31 +00:00
Andre Bogus efc4c6c957 extend single_element_loop to match .iter() 2021-04-26 15:58:58 +02:00
bors c4e2d3691b Auto merge of #7129 - camsteffen:copied-msrv, r=Manishearth
cloned_instead_of_copied MSRV

changelog: none
(since the lint is still new)

Fixes #7127

r? `@Manishearth`
2021-04-25 14:55:24 +00:00
Cameron Steffen 3f5be5e235 Fix cloned_instead_of_copied MSRV 2021-04-25 09:54:04 -05:00
Jason Newcomb db7ad648e7
Fix ICE checking for feature gated const fn 2021-04-25 10:18:15 -04:00
bors 08e36d7527 Auto merge of #7124 - Jarcho:lintcheck-windows, r=phansch
Fix lintcheck on windows

changelog: None
2021-04-23 06:10:54 +00:00
Jason Newcomb 6c423757dd
Fix lintcheck on windows 2021-04-22 13:16:54 -04:00
bors 74f55996fe Auto merge of #7120 - cherryblossom000:7106, r=Manishearth
`single_component_path_imports`: ignore `pub(crate) use some_macro;`

Fixes #7106

*Please write a short comment explaining your change (or "none" for internal only changes)*

changelog: Ignore exporting a macro within a crate using `pub(crate) use some_macro;` for [`single_component_path_imports`]
2021-04-22 14:36:21 +00:00
bors 0ab7acc890 Auto merge of #7100 - ABouttefeux:unused_io_amount, r=camsteffen
Unused io amount detects `.read().ok()?`

fixes #7096
changelog: unused_io_amount now detect expertion like `.read().ok()?`,  `.read().or_else(|err| ...)?` and similar expressions.
2021-04-22 13:57:06 +00:00
Aliénore Bouttefeux 5625d58f9f add detection unused_io_amount of "or", "or_else" and "ok" 2021-04-22 15:52:42 +02:00
Jason Newcomb 3d793f3111
Minor cleanup of implicit_return 2021-04-22 09:36:49 -04:00
Jason Newcomb ef9ad80617
Add examples to better explain walk_span_to_context 2021-04-22 09:36:46 -04:00
Jason Newcomb 74cf5f2fc6
Fix implicit_return suggestion for async functions 2021-04-22 09:36:32 -04:00
Jason Newcomb 22f8c13cf5
Improve implicit_return
Better suggestions when returning macro calls.
Suggest changeing all the break expressions in a loop, not just the final statement.
Don't lint divergent functions.
Don't suggest returning the result of any divergent fuction.
2021-04-22 09:13:06 -04:00
cherryblossom b48699e4cf
single_component_path_imports: ignore pub(crate) use some_macro; (fixes #7106) 2021-04-22 19:34:36 +10:00
bors 98e2b9f25b Auto merge of #7119 - flip1995:rustup, r=flip1995
Rustup

r? `@ghost`

changelog: none
2021-04-22 09:27:42 +00:00
flip1995 876897da8f
Bump nightly version -> 2021-04-22 2021-04-22 11:25:56 +02:00
flip1995 44c8057f4d
Merge remote-tracking branch 'upstream/master' into rustup 2021-04-22 11:24:26 +02:00
bors 1f7aef336e Auto merge of #7102 - taralx:taralx-patch-1, r=flip1995
Switch transmute_ptr_to_ptr to "pedantic" class.

Per discussion in https://github.com/rust-lang/rust-clippy/issues/6372, this lint has significant false positives.

changelog: transmute_ptr_to_ptr defaults to "allow".
2021-04-22 08:26:14 +00:00
Takayuki 65778fa5e8 fix a false-positive inside const fn in comparison_chain 2021-04-22 16:58:12 +09:00
bors 79b9eb5371 Auto merge of #7072 - ebobrow:imports-ending-with-self, r=camsteffen
add unnecessary_self_imports lint

fixes #6552

changelog: add `unnecessary_self_imports` lint
2021-04-21 14:47:49 +00:00
Elliot Bobrow 224881b94d add unnecessary_self_imports lint 2021-04-21 07:17:42 -07:00
bors bbc22e2ef3 Auto merge of #7083 - GuillaumeGomez:bool-assert-eq, r=camsteffen
Add lint to check for boolean comparison in assert macro calls

This PR adds a lint to check if an assert macro is using a boolean as "comparison value". For example:

```rust
assert_eq!("a".is_empty(), false);
```

Could be rewritten as:

```rust
assert!(!"a".is_empty());
```

PS: The dev guidelines are amazing. Thanks a lot for writing them!

changelog: Add `bool_assert_comparison` lint
2021-04-21 13:58:53 +00:00
bors 926286acfe Auto merge of #7109 - ctennis:ct/asm_syntax_aarch64, r=flip1995
Ignore aarch64 for this test as it's x86 assembly only.  Fixes #7091

fixes #7091 - asm_syntax lint test will not compile on aarch64

changelog: none
2021-04-21 08:49:15 +00:00
bors ec38ea1ac1 Auto merge of #7097 - yawara:fix/7069, r=llogiq
Fixed inconsistent_struct_constructor triggers in macro-generated code

fixes #7069

changelog: `inconsistent_struct_constructor`: Fix FP in macro expansion.
2021-04-20 08:26:21 +00:00