]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoSkip function with no exprs contained
Hirochika Matsumoto [Sun, 18 Oct 2020 08:27:08 +0000 (17:27 +0900)]
Skip function with no exprs contained

3 years agoMake lint skip macros
Hirochika Matsumoto [Sun, 18 Oct 2020 08:17:45 +0000 (17:17 +0900)]
Make lint skip macros

3 years agoAdd support for methods
Hirochika Matsumoto [Sun, 18 Oct 2020 07:53:18 +0000 (16:53 +0900)]
Add support for methods

3 years agoMake lint skip closures
Hirochika Matsumoto [Sun, 18 Oct 2020 07:30:46 +0000 (16:30 +0900)]
Make lint skip closures

3 years agoRun `cargo dev fmt`
Hirochika Matsumoto [Mon, 12 Oct 2020 10:37:27 +0000 (19:37 +0900)]
Run `cargo dev fmt`

3 years agoImprove lint message
Hirochika Matsumoto [Mon, 12 Oct 2020 10:27:47 +0000 (19:27 +0900)]
Improve lint message

3 years agoUpdate clippy_lints/src/unnecessary_wrap.rs
Hirochika Matsumoto [Mon, 12 Oct 2020 10:21:04 +0000 (19:21 +0900)]
Update clippy_lints/src/unnecessary_wrap.rs

Co-authored-by: Philipp Krones <hello@philkrones.com>
3 years agoMove `find_all_ret_expressions` into `utils`
Hirochika Matsumoto [Fri, 2 Oct 2020 09:21:17 +0000 (18:21 +0900)]
Move `find_all_ret_expressions` into `utils`

3 years agoAdd test case
Hirochika Matsumoto [Sat, 26 Sep 2020 07:27:10 +0000 (16:27 +0900)]
Add test case

3 years agoSplit lint suggestion into two
Hirochika Matsumoto [Sat, 26 Sep 2020 06:39:39 +0000 (15:39 +0900)]
Split lint suggestion into two

3 years agoRun rustfmt
Hirochika Matsumoto [Tue, 22 Sep 2020 18:48:15 +0000 (03:48 +0900)]
Run rustfmt

3 years agoCall `diag.multipart_suggestion` instead
Hirochika Matsumoto [Tue, 22 Sep 2020 18:42:58 +0000 (03:42 +0900)]
Call `diag.multipart_suggestion` instead

3 years agoFix typo
Hirochika Matsumoto [Tue, 22 Sep 2020 18:06:52 +0000 (03:06 +0900)]
Fix typo

Co-authored-by: Philipp Krones <hello@philkrones.com>
3 years agoOptout rustfix test
Hirochika Matsumoto [Tue, 22 Sep 2020 17:57:47 +0000 (02:57 +0900)]
Optout rustfix test

3 years agoRefactor code according to reivews
Hirochika Matsumoto [Tue, 22 Sep 2020 17:53:55 +0000 (02:53 +0900)]
Refactor code according to reivews

3 years agoAdd test cases
Hirochika Matsumoto [Sun, 20 Sep 2020 15:11:28 +0000 (00:11 +0900)]
Add test cases

3 years agoFix lint example
Hirochika Matsumoto [Sun, 20 Sep 2020 15:06:25 +0000 (00:06 +0900)]
Fix lint example

3 years agoAdd suggestion on type signatures
Hirochika Matsumoto [Sun, 20 Sep 2020 09:22:01 +0000 (18:22 +0900)]
Add suggestion on type signatures

3 years agoAdd new lint to detect unnecessarily wrapped value
Hirochika Matsumoto [Sat, 19 Sep 2020 17:03:14 +0000 (02:03 +0900)]
Add new lint to detect unnecessarily wrapped value

3 years agoAuto merge of #6119 - rsulli55:find_is_some_on_strs, r=flip1995
bors [Mon, 16 Nov 2020 08:45:10 +0000 (08:45 +0000)]
Auto merge of #6119 - rsulli55:find_is_some_on_strs, r=flip1995

Add a case to `lint_search_is_some` to handle searching strings

Fixes: #6010
This adds a lint which recommends using `contains()` instead of `find()` followed by `is_some()` on strings as suggested in #6010.

This was added as an additional case to
https://github.com/rust-lang/rust-clippy/blob/5af88e3c2d8cc4fb74a0e455381669930ee3a31a/clippy_lints/src/methods/mod.rs#L3037

I would really appreciate any comments/suggestions for my code!

changelog: Added case to `lint_search_is_some` to handle searching strings

3 years agoAuto merge of #6336 - giraffate:sync-from-rust, r=flip1995
bors [Mon, 16 Nov 2020 08:23:27 +0000 (08:23 +0000)]
Auto merge of #6336 - giraffate:sync-from-rust, r=flip1995

Rustup

changelog: none

3 years agoAdd `rustfmt::skip` as a work around
Takayuki Nakata [Mon, 16 Nov 2020 03:14:10 +0000 (12:14 +0900)]
Add `rustfmt::skip` as a work around

because comments are checked and removed by rustfmt for some reason

3 years agoAuto merge of #6334 - flip1995:rustup, r=flip1995
bors [Sun, 15 Nov 2020 13:09:53 +0000 (13:09 +0000)]
Auto merge of #6334 - flip1995:rustup, r=flip1995

Rustup

r? `@ghost`

changelog: none

3 years agoRollup merge of #79016 - fanzier:underscore-expressions, r=petrochenkov
Jonas Schievink [Sun, 15 Nov 2020 12:39:48 +0000 (13:39 +0100)]
Rollup merge of #79016 - fanzier:underscore-expressions, r=petrochenkov

Make `_` an expression, to discard values in destructuring assignments

This is the third and final step towards implementing destructuring assignment (RFC: rust-lang/rfcs#2909, tracking issue: #71126). This PR is the third and final part of #71156, which was split up to allow for easier review.

With this PR, an underscore `_` is parsed as an expression but is allowed *only* on the left-hand side of a destructuring assignment. There it simply discards a value, similarly to the wildcard `_` in patterns. For instance,
```rust
(a, _) = (1, 2)
```
will simply assign 1 to `a` and discard the 2. Note that for consistency,
```
_ = foo
```
is also allowed and equivalent to just `foo`.

Thanks to ````@varkor```` who helped with the implementation, particularly around pre-expansion gating.

r? ````@petrochenkov````

3 years agoAuto merge of #78809 - vn-ki:fix-issue-76064, r=oli-obk
bors [Sat, 14 Nov 2020 18:03:17 +0000 (18:03 +0000)]
Auto merge of #78809 - vn-ki:fix-issue-76064, r=oli-obk

add error_occured field to ConstQualifs,

fix #76064

I wasn't sure what `in_return_place` actually did and not sure why it returns `ConstQualifs` while it's sibling functions return `bool`. So I tried to make as minimal changes to the structure as possible. Please point out whether I have to refactor it or not.

r? `@oli-obk`
cc `@RalfJung`

3 years agoAdd underscore expressions for destructuring assignments
Fabian Zaiser [Wed, 11 Nov 2020 13:15:15 +0000 (13:15 +0000)]
Add underscore expressions for destructuring assignments

Co-authored-by: varkor <github@varkor.com>
3 years agoAuto merge of #6320 - giraffate:fix_suggestion_in_manual_range_contains_using_float...
bors [Sat, 14 Nov 2020 08:06:00 +0000 (08:06 +0000)]
Auto merge of #6320 - giraffate:fix_suggestion_in_manual_range_contains_using_float, r=llogiq

Fix suggestion in `manual_range_contains` when using float

Fix #6315

changelog: Fix suggestion in `manual_range_contains` when using float

3 years agoupdate clippy test ouput
Vishnunarayan K I [Fri, 13 Nov 2020 11:41:13 +0000 (17:11 +0530)]
update clippy test ouput

3 years agoAuto merge of #6329 - giraffate:sync-from-rust, r=matthiaskrgr
bors [Fri, 13 Nov 2020 10:49:21 +0000 (10:49 +0000)]
Auto merge of #6329 - giraffate:sync-from-rust, r=matthiaskrgr

Rustup

changelog: none

3 years agoFix dogfood test
Takayuki Nakata [Fri, 13 Nov 2020 05:47:23 +0000 (14:47 +0900)]
Fix dogfood test

3 years agoRollup merge of #78836 - fanzier:struct-and-slice-destructuring, r=petrochenkov
Mara Bos [Thu, 12 Nov 2020 18:46:09 +0000 (19:46 +0100)]
Rollup merge of #78836 - fanzier:struct-and-slice-destructuring, r=petrochenkov

Implement destructuring assignment for structs and slices

This is the second step towards implementing destructuring assignment (RFC: rust-lang/rfcs#2909, tracking issue: #71126). This PR is the second part of #71156, which was split up to allow for easier review.

Note that the first PR (#78748) is not merged yet, so it is included as the first commit in this one. I thought this would allow the review to start earlier because I have some time this weekend to respond to reviews. If ``@petrochenkov`` prefers to wait until the first PR is merged, I totally understand, of course.

This PR implements destructuring assignment for (tuple) structs and slices. In order to do this, the following *parser change* was necessary: struct expressions are not required to have a base expression, i.e. `Struct { a: 1, .. }` becomes legal (in order to act like a struct pattern).

Unfortunately, this PR slightly regresses the diagnostics implemented in #77283. However, it is only a missing help message in `src/test/ui/issues/issue-77218.rs`. Other instances of this diagnostic are not affected. Since I don't exactly understand how this help message works and how to fix it yet, I was hoping it's OK to regress this temporarily and fix it in a follow-up PR.

Thanks to ``@varkor`` who helped with the implementation, particularly around the struct rest changes.

r? ``@petrochenkov``

3 years agoAuto merge of #6325 - flip1995:rustup, r=flip1995
bors [Thu, 12 Nov 2020 07:40:33 +0000 (07:40 +0000)]
Auto merge of #6325 - flip1995:rustup, r=flip1995

Rustup

r? `@ghost`

changelog: none

3 years agoAuto merge of #78782 - petrochenkov:nodoctok, r=Aaron1011
bors [Thu, 12 Nov 2020 00:33:55 +0000 (00:33 +0000)]
Auto merge of #78782 - petrochenkov:nodoctok, r=Aaron1011

Do not collect tokens for doc comments

Doc comment is a single token and AST has all the information to re-create it precisely.
Doc comments are also responsible for majority of calls to `collect_tokens` (with `num_calls == 1` and `num_calls == 0`, cc https://github.com/rust-lang/rust/pull/78736).

(I also moved token collection into `fn parse_attribute` to deduplicate code a bit.)

r? `@Aaron1011`

3 years agoFix suggestion in `manual_range_contains` when using float
Takayuki Nakata [Wed, 11 Nov 2020 13:36:53 +0000 (22:36 +0900)]
Fix suggestion in `manual_range_contains` when using float

3 years agoImplement destructuring assignment for structs and slices
Fabian Zaiser [Sat, 7 Nov 2020 14:28:55 +0000 (14:28 +0000)]
Implement destructuring assignment for structs and slices

Co-authored-by: varkor <github@varkor.com>
3 years agoFix typo in comment
Ikko Ashimine [Wed, 11 Nov 2020 11:23:08 +0000 (20:23 +0900)]
Fix typo in comment

occurences -> occurrences

3 years agoChange variable named `foo` and rerun `update-all-references`
Ryan Sullivant [Wed, 11 Nov 2020 06:48:01 +0000 (23:48 -0700)]
Change variable named `foo` and rerun `update-all-references`

3 years agoUpdate clippy_lints/src/methods/mod.rs
rsulli55 [Wed, 11 Nov 2020 06:17:46 +0000 (23:17 -0700)]
Update clippy_lints/src/methods/mod.rs

Co-authored-by: Philipp Krones <hello@philkrones.com>
3 years agoCleaned up message and suggestion for `lint_search_is_some`
Ryan Sullivant [Sat, 7 Nov 2020 07:21:22 +0000 (00:21 -0700)]
Cleaned up message and suggestion for `lint_search_is_some`

3 years agoAdded period back to lint `search_is_some` and ran
Ryan Sullivant [Sat, 31 Oct 2020 19:40:56 +0000 (12:40 -0700)]
Added period back to lint `search_is_some` and ran
`update-all-references.sh`

3 years agoRemove borrow
rsulli55 [Mon, 26 Oct 2020 01:11:57 +0000 (18:11 -0700)]
Remove borrow

Co-authored-by: Philipp Krones <hello@philkrones.com>
3 years agoRemove `to_string` on msg
rsulli55 [Mon, 26 Oct 2020 01:11:38 +0000 (18:11 -0700)]
Remove `to_string` on msg

Co-authored-by: Philipp Krones <hello@philkrones.com>
3 years agoRan `tests/ui/update-all-references.sh" and `cargo dev fmt`
Ryan Sullivant [Sat, 17 Oct 2020 21:28:00 +0000 (14:28 -0700)]
Ran `tests/ui/update-all-references.sh" and `cargo dev fmt`

3 years agoMoved the tests for lint `search_is_some` to new files
Ryan Sullivant [Sat, 17 Oct 2020 21:07:22 +0000 (14:07 -0700)]
Moved the tests for lint `search_is_some` to new files
`search_is_some.rs` and `search_is_some_fixable.rs`

3 years agoAdded a lint as suggested in 6010 which recommends using `contains()`
Ryan Sullivant [Tue, 6 Oct 2020 04:23:36 +0000 (21:23 -0700)]
Added a lint as suggested in 6010 which recommends using `contains()`
instead of `find()` follows by `is_some()` on strings

Update clippy_lints/src/find_is_some_on_strs.rs
Co-authored-by: Takayuki Nakata <f.seasons017@gmail.com>
Update clippy_lints/src/methods/mod.rs
Co-authored-by: Philipp Krones <hello@philkrones.com>
3 years agoAuto merge of #6269 - camsteffen:map-clone-deref, r=ebroto
bors [Wed, 11 Nov 2020 00:48:33 +0000 (00:48 +0000)]
Auto merge of #6269 - camsteffen:map-clone-deref, r=ebroto

Fix map_clone with deref and clone

changelog: Fix map_clone false positive with deref coercion

Fixes #6239

3 years agoFix map_clone with deref and clone
Cameron Steffen [Fri, 30 Oct 2020 14:18:16 +0000 (09:18 -0500)]
Fix map_clone with deref and clone

3 years agoAuto merge of #6303 - ThibsG:OptionOptionSerde, r=ebroto
bors [Tue, 10 Nov 2020 22:39:10 +0000 (22:39 +0000)]
Auto merge of #6303 - ThibsG:OptionOptionSerde, r=ebroto

Remove `allow` in `option_option` lint test

As it is not triggering locally anymore, I propose to remove `#[allow(clippy::option_option)]` from the test.

The goal is also to see what happens on CI.

closes: #4298

changelog: none

3 years agoAuto merge of #6319 - ebroto:rustup, r=ebroto
bors [Tue, 10 Nov 2020 21:36:00 +0000 (21:36 +0000)]
Auto merge of #6319 - ebroto:rustup, r=ebroto

Rustup

changelog: none

r? `@ghost`

3 years agoRun cargo dev fmt
Eduardo Broto [Tue, 10 Nov 2020 21:33:02 +0000 (22:33 +0100)]
Run cargo dev fmt

3 years agoMerge remote-tracking branch 'upstream/master' into rustup
Eduardo Broto [Tue, 10 Nov 2020 21:32:24 +0000 (22:32 +0100)]
Merge remote-tracking branch 'upstream/master' into rustup

3 years agoAuto merge of #6305 - smoelius:master, r=flip1995
bors [Mon, 9 Nov 2020 19:13:26 +0000 (19:13 +0000)]
Auto merge of #6305 - smoelius:master, r=flip1995

Add `let_underscore_drop`

This line generalizes `let_underscore_lock` (#5101) to warn about any initializer expression that implements `Drop`.

So, for example, the following would generate a warning:
```rust
struct Droppable;
impl Drop for Droppable {
    fn drop(&mut self) {}
}
let _ = Droppable;
```

I tried to preserve the original `let_underscore_lock` functionality in the sense that the warning generated for
```rust
let _ = mutex.lock();
```
should be unchanged.

*Please keep the line below*
changelog: Add lint [`let_underscore_drop`]

3 years agoRollup merge of #78710 - petrochenkov:macvisit, r=davidtwco
Dylan DPC [Mon, 9 Nov 2020 18:06:55 +0000 (19:06 +0100)]
Rollup merge of #78710 - petrochenkov:macvisit, r=davidtwco

rustc_ast: Do not panic by default when visiting macro calls

Panicking by default made sense when we didn't have HIR or MIR and everything worked on AST, but now all AST visitors run early and majority of them have to deal with macro calls, often by ignoring them.

The second commit renames `visit_mac` to `visit_mac_call`, the corresponding structures were renamed earlier in https://github.com/rust-lang/rust/pull/69589.

3 years agoAllow `let_underscore_drop` in `filter_methods` test
Samuel E. Moelius III [Mon, 9 Nov 2020 12:49:14 +0000 (07:49 -0500)]
Allow `let_underscore_drop` in `filter_methods` test

3 years agoAuto merge of #6278 - ThibsG:DerefAddrOf, r=llogiq
bors [Mon, 9 Nov 2020 05:25:04 +0000 (05:25 +0000)]
Auto merge of #6278 - ThibsG:DerefAddrOf, r=llogiq

Fix bad suggestions for `deref_addrof` and `try_err` lints

Fix bad suggestions when in macro expansion for `deref_addrof` and `try_err` lints.

Fixes: #6234
Fixes: #6242
Fixes: #6237
changelog: none

r? `@llogiq`

3 years agoUpdate references
Samuel E. Moelius III [Sun, 8 Nov 2020 23:32:12 +0000 (18:32 -0500)]
Update references

3 years agoDo not collect tokens for doc comments
Vadim Petrochenkov [Thu, 5 Nov 2020 17:27:48 +0000 (20:27 +0300)]
Do not collect tokens for doc comments

3 years agoUpdate lints
Samuel E. Moelius III [Sun, 8 Nov 2020 22:33:54 +0000 (17:33 -0500)]
Update lints

3 years agoUpdate clippy_lints/src/let_underscore.rs
Samuel E. Moelius [Sun, 8 Nov 2020 22:25:50 +0000 (17:25 -0500)]
Update clippy_lints/src/let_underscore.rs

Co-authored-by: Philipp Krones <hello@philkrones.com>
3 years agoUpdate clippy_lints/src/let_underscore.rs
Samuel E. Moelius [Sun, 8 Nov 2020 22:25:23 +0000 (17:25 -0500)]
Update clippy_lints/src/let_underscore.rs

Co-authored-by: Philipp Krones <hello@philkrones.com>
3 years agoUpdate clippy_lints/src/let_underscore.rs
Samuel E. Moelius [Sun, 8 Nov 2020 22:24:55 +0000 (17:24 -0500)]
Update clippy_lints/src/let_underscore.rs

Co-authored-by: Philipp Krones <hello@philkrones.com>
3 years agoAuto merge of #6267 - camsteffen:or-fun-idx, r=flip1995
bors [Sun, 8 Nov 2020 22:03:27 +0000 (22:03 +0000)]
Auto merge of #6267 - camsteffen:or-fun-idx, r=flip1995

Fix or_fun_call for index operator

changelog: Fix or_fun_call for index operator

Fixes #6266

3 years agoFix or_fun_call for index operator
Cameron Steffen [Thu, 29 Oct 2020 20:30:20 +0000 (15:30 -0500)]
Fix or_fun_call for index operator

3 years agoMake KNOW_TYPES static
Cameron Steffen [Thu, 29 Oct 2020 21:21:01 +0000 (16:21 -0500)]
Make KNOW_TYPES static

3 years agoAuto merge of #6288 - flip1995:changelog_internal, r=matthiaskrgr
bors [Sun, 8 Nov 2020 19:37:25 +0000 (19:37 +0000)]
Auto merge of #6288 - flip1995:changelog_internal, r=matthiaskrgr

Require the `changelog:` entry in the PR body to be modified

r? `@matthiaskrgr`

changelog: none

3 years agoForce contributors/reviewers to set _some_ changelog entry
flip1995 [Sun, 8 Nov 2020 15:14:38 +0000 (16:14 +0100)]
Force contributors/reviewers to set _some_ changelog entry

3 years agoAuto merge of #6293 - Urcra:lint-example-fix, r=flip1995
bors [Sun, 8 Nov 2020 14:24:58 +0000 (14:24 +0000)]
Auto merge of #6293 - Urcra:lint-example-fix, r=flip1995

Fix example used in cargo_common_metadata

The previous example used in `cargo_common_metadata`  included an authors field, even though the comment says it doesn't. And thus doesn't actually demonstrate an example of how the lint fails.

This removes that authors field from the _bad_ example and suggest to fix the _bad_ example by adding the authors field

changelog: Fix example used in `cargo_common_metadata`

3 years agoUpdate references
Samuel E. Moelius III [Sun, 8 Nov 2020 12:07:49 +0000 (07:07 -0500)]
Update references

3 years agoAuto merge of #6271 - camsteffen:vec-box-import, r=flip1995
bors [Sun, 8 Nov 2020 12:02:30 +0000 (12:02 +0000)]
Auto merge of #6271 - camsteffen:vec-box-import, r=flip1995

Fix vec_box scope error

changelog: Fix vec_box suggestion with wrong type scope

Fixes #6236

3 years agoAdd let_underscore_drop
Samuel E. Moelius III [Sat, 7 Nov 2020 23:26:14 +0000 (18:26 -0500)]
Add let_underscore_drop

3 years agoAuto merge of #6205 - josephlr:empty-loop2, r=flip1995
bors [Sun, 8 Nov 2020 11:41:22 +0000 (11:41 +0000)]
Auto merge of #6205 - josephlr:empty-loop2, r=flip1995

Enable empty_loop lint for no_std crates

Depends on #6162. Fixes #6161

We skip the lint if the `loop {}` is in the `#[panic_handler]` as the
main recommendation we give is to panic, which obviously isn't
possible in a panic handler.

changelog: Enable empty_loop lint for no_std crates

3 years agoUpdate reference files
flip1995 [Sun, 8 Nov 2020 11:40:41 +0000 (12:40 +0100)]
Update reference files

3 years agoUpdate clippy_lints/src/loops.rs
Joseph Richey [Wed, 4 Nov 2020 11:27:30 +0000 (03:27 -0800)]
Update clippy_lints/src/loops.rs

Fix NITs

Co-authored-by: Philipp Krones <hello@philkrones.com>
3 years agoEnable empty_loop lint for no_std crates
Joe Richey [Fri, 23 Oct 2020 06:39:25 +0000 (23:39 -0700)]
Enable empty_loop lint for no_std crates

We skip the lint if the `loop {}` is in the `#[panic_handler]` as the
main recommendation we give is to panic, which obviously isn't
possible in a panic handler.

Signed-off-by: Joe Richey <joerichey@google.com>
3 years agoAuto merge of #6301 - alex-700:fix-map-clone, r=matthiaskrgr
bors [Sun, 8 Nov 2020 01:28:27 +0000 (01:28 +0000)]
Auto merge of #6301 - alex-700:fix-map-clone, r=matthiaskrgr

do not trigger map_clone in the case of &mut

fixes #6299
changelog: do not trigger map_clone in the case of &mut

3 years agoAuto merge of #6304 - matthiaskrgr:crash_6302, r=llogiq
bors [Sat, 7 Nov 2020 18:10:35 +0000 (18:10 +0000)]
Auto merge of #6304 - matthiaskrgr:crash_6302, r=llogiq

FROM_ITER_INSTEAD_OF_COLLECT: avoid unwrapping unconditionally

Fixes #6302

changelog: fix unwrap of None when checking libcore with clippy

3 years agoAuto merge of #6298 - JohnTitor:fix-example, r=llogiq
bors [Sat, 7 Nov 2020 17:48:46 +0000 (17:48 +0000)]
Auto merge of #6298 - JohnTitor:fix-example, r=llogiq

Fix `await_holding_refcell_ref` examples for clarify

- Remove redundant `()`
- Fix variable name

changelog: none

3 years agoAuto merge of #6287 - camsteffen:readme, r=llogiq
bors [Sat, 7 Nov 2020 17:26:58 +0000 (17:26 +0000)]
Auto merge of #6287 - camsteffen:readme, r=llogiq

Readme improvements

~Moved the table of contents up, added an Overview heading.~

~Made the "All the Clippy Lints" link clearer.~

Formatted the lint categories as a table with the default lint level (instead of saying on/off by default). Tweaked the descriptions.

changelog: Improve Readme

3 years agoAuto merge of #6134 - patrickelectric:as_utf8, r=llogiq
bors [Sat, 7 Nov 2020 17:06:27 +0000 (17:06 +0000)]
Auto merge of #6134 - patrickelectric:as_utf8, r=llogiq

Check when `from_utf8` is called from sliced byte array from string

---

*Please keep the line below*
changelog: Fix #5487: Add linter to check when `from_utf8` is called from sliced byte array from string.

3 years agoAuto merge of #6110 - rail-rain:care_enums_non_copy_const, r=llogiq
bors [Sat, 7 Nov 2020 15:51:13 +0000 (15:51 +0000)]
Auto merge of #6110 - rail-rain:care_enums_non_copy_const, r=llogiq

"Respect" enums in `interior_mutable_const`

fixes #3962
fixes #3825

Hello,

It might not be a good idea to submit another relatively large PR while I have an opened PR; but, I've finished this anyway. This may be able to wait for months.

Note: the code uses the MIR interpreter, which the author of #3962 thought unlikely to be a solution. This might be over-engineering; but, I think it's important to be able to work with the 'http' crate (#3825). (And, I don't want to write a MIR visitor)

---

changelog: fix a false positive in two `interior_mutable_const` lints where a constant with enums gets linted
even if it uses a clearly unfrozen variant

3 years agoAuto merge of #6272 - camsteffen:unnecesary-lazy-eval-type, r=llogiq
bors [Sat, 7 Nov 2020 10:01:46 +0000 (10:01 +0000)]
Auto merge of #6272 - camsteffen:unnecesary-lazy-eval-type, r=llogiq

Fix unnecessary_lazy_eval suggestion applicability

changelog: Fix unnecessary_lazy_eval suggestion applicability when breaking type inference

Fixes #6240

3 years agoFROM_ITER_INSTEAD_OF_COLLECT: avoid unwrapping unconditionally
Matthias Krüger [Fri, 6 Nov 2020 18:34:34 +0000 (19:34 +0100)]
FROM_ITER_INSTEAD_OF_COLLECT: avoid unwrapping unconditionally

Fixes #6302

3 years agoAuto merge of #6294 - giraffate:fix_suggestion_to_add_space_in_manual_async, r=Manish...
bors [Fri, 6 Nov 2020 18:10:43 +0000 (18:10 +0000)]
Auto merge of #6294 - giraffate:fix_suggestion_to_add_space_in_manual_async, r=Manishearth

Fix suggestion to add unneeded space in `manual_async`

Fix a same case as https://github.com/rust-lang/rust-clippy/pull/6247

changelog: Fix suggestion to add unneeded space in `manual_async`

3 years agoRemove needless allow
ThibsG [Fri, 30 Oct 2020 17:43:27 +0000 (18:43 +0100)]
Remove needless allow

3 years agoRefactor to make getting position just before RArrow a common function
Takayuki Nakata [Fri, 6 Nov 2020 13:54:38 +0000 (22:54 +0900)]
Refactor to make getting position just before RArrow a common function

3 years agodo not trigger map_clone in the case of &mut
Aleksei Latyshev [Fri, 6 Nov 2020 11:38:46 +0000 (14:38 +0300)]
do not trigger map_clone in the case of &mut

3 years agoFix suggestion to add unneeded space in `manual_async`
Takayuki Nakata [Thu, 5 Nov 2020 04:56:57 +0000 (13:56 +0900)]
Fix suggestion to add unneeded space in `manual_async`

3 years agoFix `await_holding_refcell_ref` examples for clarify
Yuki Okushi [Thu, 5 Nov 2020 19:02:41 +0000 (04:02 +0900)]
Fix `await_holding_refcell_ref` examples for clarify

3 years agoFix incorrect suggestion for `try_err` lint when `Err` arg is itself a macro
ThibsG [Thu, 5 Nov 2020 17:00:34 +0000 (18:00 +0100)]
Fix incorrect suggestion for `try_err` lint when `Err` arg is itself a macro

3 years agoMerge commit 'b20d4c155d2fe3a8391f86dcf9a8c49e17188703' into clippyup
flip1995 [Thu, 5 Nov 2020 13:29:48 +0000 (14:29 +0100)]
Merge commit 'b20d4c155d2fe3a8391f86dcf9a8c49e17188703' into clippyup

3 years agoAuto merge of #6296 - flip1995:rustup, r=flip1995
bors [Thu, 5 Nov 2020 13:14:26 +0000 (13:14 +0000)]
Auto merge of #6296 - flip1995:rustup, r=flip1995

Rustup

r? `@ghost`

changelog: none

3 years agoSkip rustfmt as it is wanted for this test
ThibsG [Mon, 2 Nov 2020 17:03:16 +0000 (18:03 +0100)]
Skip rustfmt as it is wanted for this test

3 years agoAdd string_from_utf8_as_bytes linter
Patrick José Pereira [Thu, 8 Oct 2020 03:19:56 +0000 (00:19 -0300)]
Add string_from_utf8_as_bytes linter

Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
3 years agoReadme improvements
Cameron Steffen [Tue, 3 Nov 2020 17:44:26 +0000 (11:44 -0600)]
Readme improvements

Format lint categories as a table with the default lint level.

3 years agoAuto merge of #78662 - sexxi-goose:add_expr_id_to_delegate, r=nikomatsakis
bors [Wed, 4 Nov 2020 22:45:15 +0000 (22:45 +0000)]
Auto merge of #78662 - sexxi-goose:add_expr_id_to_delegate, r=nikomatsakis

Provide diagnostic suggestion in ExprUseVisitor Delegate

The [Delegate trait](https://github.com/rust-lang/rust/blob/981346fc07dd5ef414c5b1b21999f7604cece006/compiler/rustc_typeck/src/expr_use_visitor.rs#L28-L38) currently use `PlaceWithHirId` which is composed of Hir `Place` and the
corresponding expression id.

Even though this is an accurate way of expressing how a Place is used,
it can cause confusion during diagnostics.

Eg:

```
let arr : [String; 5];

let [a, ...]     =   arr;
 ^^^ E1 ^^^      =  ^^E2^^
 ```

 Here `arr` is moved because of the binding created E1. However, when we
 point to E1 in diagnostics with the message `arr` was moved, it can be
 confusing.  Rather we would like to report E2 to the user.

Closes: https://github.com/rust-lang/project-rfc-2229/issues/20
r? `@ghost`

3 years agoAuto merge of #6247 - giraffate:fix_suggestion_to_add_space_in_unused_unit, r=ebroto
bors [Wed, 4 Nov 2020 22:42:10 +0000 (22:42 +0000)]
Auto merge of #6247 - giraffate:fix_suggestion_to_add_space_in_unused_unit, r=ebroto

Fix suggestion to add unneeded space in `unused_unit`

Fix https://github.com/rust-lang/rust-clippy/issues/6230

changelog: Fix suggestion to add unneeded space in `unused_unit`

3 years agoFix example for cargo common data
Urcra [Wed, 4 Nov 2020 22:39:52 +0000 (23:39 +0100)]
Fix example for cargo common data

3 years agoAuto merge of #5911 - hegza:issue-568, r=ebroto
bors [Wed, 4 Nov 2020 22:21:44 +0000 (22:21 +0000)]
Auto merge of #5911 - hegza:issue-568, r=ebroto

Add lint for 'field_reassign_with_default` #568

changelog: Add lint for field_reassign_with_default that checks if mutable object + field modification is used to edit a binding initialized with Default::default() instead of struct constructor.

Fixes #568

Notes:
- Checks for reassignment of one or more fields of a binding initialized with Default::default().
- Implemented using EarlyLintPass, might be future proofed better with LateLintPass.
- Does not trigger if Default::default() is used via another type implementing Default.
- This is a re-open of [PR#4761](https://github.com/rust-lang/rust-clippy/pull/4761), but I couldn't figure out how to re-open that one so here's a new one with the requested changes :S

3 years agoAuto merge of #6292 - ebroto:rustup, r=ebroto
bors [Wed, 4 Nov 2020 21:53:32 +0000 (21:53 +0000)]
Auto merge of #6292 - ebroto:rustup, r=ebroto

Rustup

changelog: none

r? `@ghost`

3 years agoRun cargo dev fmt
Eduardo Broto [Wed, 4 Nov 2020 21:41:15 +0000 (22:41 +0100)]
Run cargo dev fmt