]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoAuto merge of #7083 - GuillaumeGomez:bool-assert-eq, r=camsteffen
bors [Wed, 21 Apr 2021 13:58:53 +0000 (13:58 +0000)]
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

3 years agoAuto merge of #7109 - ctennis:ct/asm_syntax_aarch64, r=flip1995
bors [Wed, 21 Apr 2021 08:49:15 +0000 (08:49 +0000)]
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

3 years agoAuto merge of #7097 - yawara:fix/7069, r=llogiq
bors [Tue, 20 Apr 2021 08:26:21 +0000 (08:26 +0000)]
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.

3 years agoAdd a test for FP in macro expansion
Yawara ISHIDA [Tue, 20 Apr 2021 04:33:39 +0000 (13:33 +0900)]
Add a test for FP in macro expansion

3 years agoAuto merge of #7092 - basavesh:fix#7066, r=giraffate
bors [Mon, 19 Apr 2021 23:06:21 +0000 (23:06 +0000)]
Auto merge of #7092 - basavesh:fix#7066, r=giraffate

useless use of format! should return function directly

fixes #7066

changelog: [`useless_format`] wraps the content in the braces when it's needed.

r? `@giraffate`

3 years agoAdd lint to check for boolean comparison in assert macro calls
Guillaume Gomez [Thu, 15 Apr 2021 13:26:57 +0000 (15:26 +0200)]
Add lint to check for boolean comparison in assert macro calls

3 years agoAuto merge of #7111 - giraffate:fix_link_in_doc, r=Manishearth
bors [Mon, 19 Apr 2021 15:56:04 +0000 (15:56 +0000)]
Auto merge of #7111 - giraffate:fix_link_in_doc, r=Manishearth

Fix links in doc

changelog: none

3 years agoIgnore aarch64 for this test as it's x86 assembly only. Fixes #7091
Caleb Tennis [Sun, 18 Apr 2021 23:13:46 +0000 (19:13 -0400)]
Ignore aarch64 for this test as it's x86 assembly only.  Fixes #7091

3 years agouseless use of format! should return function directly
Basavesh Shivakumar [Mon, 19 Apr 2021 15:20:21 +0000 (17:20 +0200)]
useless use of format! should return function directly

3 years agoAuto merge of #7112 - giraffate:update_pull_request_template, r=camsteffen
bors [Mon, 19 Apr 2021 14:39:11 +0000 (14:39 +0000)]
Auto merge of #7112 - giraffate:update_pull_request_template, r=camsteffen

Update pull request template

A follow-up of <https://github.com/rust-lang/rust-clippy/pull/7064#issuecomment-817857168>.

changelog: none

3 years agoUpdate pull request template
Takayuki Nakata [Mon, 19 Apr 2021 14:02:41 +0000 (23:02 +0900)]
Update pull request template

3 years agoFix links in doc
Takayuki Nakata [Mon, 19 Apr 2021 13:47:09 +0000 (22:47 +0900)]
Fix links in doc

3 years agoAuto merge of #7101 - camsteffen:flat-map-option, r=giraffate
bors [Mon, 19 Apr 2021 13:34:23 +0000 (13:34 +0000)]
Auto merge of #7101 - camsteffen:flat-map-option, r=giraffate

Add flat_map_option lint

changelog: Add flat_map_option lint

Closes #2241

3 years agoAuto merge of #7108 - rust-lang:fix-return-try-err, r=Manishearth
bors [Sun, 18 Apr 2021 23:47:18 +0000 (23:47 +0000)]
Auto merge of #7108 - rust-lang:fix-return-try-err, r=Manishearth

un-double `return` on try_err

This fixes #7103 by looking at the parent expression and omitting the "return " in the suggestion when its already a `return` expression.

---

changelog: none

3 years agoun-double `return` on try_err
Andre Bogus [Sun, 18 Apr 2021 21:49:54 +0000 (23:49 +0200)]
un-double `return` on try_err

3 years agoAuto merge of #7099 - ABouttefeux:master, r=llogiq
bors [Fri, 16 Apr 2021 21:22:24 +0000 (21:22 +0000)]
Auto merge of #7099 - ABouttefeux:master, r=llogiq

add type in help message of from_over_into

fixes #7088
changelog: add type in help message of from_over_into

3 years agoAdd flat_map_option lint
Cameron Steffen [Fri, 16 Apr 2021 20:06:21 +0000 (15:06 -0500)]
Add flat_map_option lint

3 years agoAuto merge of #7087 - Jarcho:allman_style_else, r=camsteffen
bors [Fri, 16 Apr 2021 20:16:52 +0000 (20:16 +0000)]
Auto merge of #7087 - Jarcho:allman_style_else, r=camsteffen

Allow allman style braces in `suspicious_else_formatting`

fixes: #3864

Indentation checks could be added as well, but the lint already doesn't check for it.

changelog: Allow allman style braces in `suspicious_else_formatting`

3 years agoAllow allman style braces in `suspicious_else_formatting`
Jason Newcomb [Thu, 15 Apr 2021 15:49:45 +0000 (11:49 -0400)]
Allow allman style braces in `suspicious_else_formatting`

3 years agoAuto merge of #7075 - xFrednet:7054-fp-branches-sharing-code, r=camsteffen,flip1995
bors [Fri, 16 Apr 2021 18:33:45 +0000 (18:33 +0000)]
Auto merge of #7075 - xFrednet:7054-fp-branches-sharing-code, r=camsteffen,flip1995

Fixing FPs for the `branches_sharing_code` lint

Fixes #7053
Fixes #7054
And an additional CSS adjustment to support dark mode for every inline code. It currently only works in paragraphs, which was an oversight on my part :sweat_smile:. [Current Example](https://rust-lang.github.io/rust-clippy/master/index.html#blacklisted_name)

This also includes ~50 lines of doc comments and is therefor not as big as the changes would indicate. :penguin:

---

changelog: none

All of these bugs were introduced in this dev version and are therefor not worth a change log entry.

r? `@phansch`
cc: `@camsteffen` since you have a pretty good overview of the `SpanlessEq` implementation :upside_down_face:

3 years agoadded missing line in test ouput
Aliénore Bouttefeux [Fri, 16 Apr 2021 18:13:25 +0000 (20:13 +0200)]
added missing line in test ouput

3 years agoadd type in help of from over Into
Aliénore Bouttefeux [Fri, 16 Apr 2021 17:38:01 +0000 (19:38 +0200)]
add type in help of from over Into

3 years agoAuto merge of #7098 - camsteffen:cloned-copied, r=Manishearth
bors [Fri, 16 Apr 2021 17:32:13 +0000 (17:32 +0000)]
Auto merge of #7098 - camsteffen:cloned-copied, r=Manishearth

Add `cloned_instead_of_copied` lint

Don't go cloning all willy-nilly.

Featuring a new `get_iterator_item_ty` util!

changelog: Add cloned_instead_of_copied lint

Closes #3870

3 years agoAuto merge of #6568 - Jarcho:redundant_pattern_matching, r=flip1995
bors [Fri, 16 Apr 2021 16:45:59 +0000 (16:45 +0000)]
Auto merge of #6568 - Jarcho:redundant_pattern_matching, r=flip1995

Fix: redundant_pattern_matching drop order

Fixes #5746

A note about the change in drop order is added when the scrutinee (or any temporary in the expression) isn't known to be safe to drop in any order (i.e. doesn't implement the `Drop` trait, or contain such a type). There is a whitelist for some `std` types, but it's incomplete. Currently just `Vec<_>`, `Box<_>`, `Rc<_>` and `Arc<_>`, but only if the contained type is also safe to drop in any order.

Another lint for when the drop order changes could be added as allowed by default, but the drop order requirement is pretty subtle in this case. I think the note added to the lint should be enough to make someone think before applying the change.

changelog: Added a note to `redundant_pattern_matching` when the change in drop order might matter

3 years agoEat dogfood
Cameron Steffen [Fri, 16 Apr 2021 16:07:08 +0000 (11:07 -0500)]
Eat dogfood

3 years agoAdd cloned_instead_of_copied lint
Cameron Steffen [Fri, 16 Apr 2021 16:00:08 +0000 (11:00 -0500)]
Add cloned_instead_of_copied lint

3 years agoFixed incosistent_struct_constructor triggers in macro-generated code
Yawara ISHIDA [Fri, 16 Apr 2021 13:50:04 +0000 (22:50 +0900)]
Fixed incosistent_struct_constructor triggers in macro-generated code

3 years agoAuto merge of #6937 - Jarcho:map_entry_suggestion, r=giraffate
bors [Fri, 16 Apr 2021 13:23:23 +0000 (13:23 +0000)]
Auto merge of #6937 - Jarcho:map_entry_suggestion, r=giraffate

Improve `map_entry` suggestion

fixes: #5176
fixes: #4674
fixes: #4664
fixes: #1450

Still need to handle the value returned by `insert` correctly.

changelog: Improve `map_entry` suggestion. Will now suggest `or_insert`, `insert_with` or `match _.entry(_)` as appopriate.
changelog: Fix `map_entry` false positives where the entry api can't be used. e.g. when the map is used for multiple things.

3 years agoAuto merge of #7093 - Jarcho:single_match_fp, r=llogiq
bors [Fri, 16 Apr 2021 06:44:26 +0000 (06:44 +0000)]
Auto merge of #7093 - Jarcho:single_match_fp, r=llogiq

Fix `single_match`

fixes: #7038
changelog: Don't suggest an equality check for types which don't implement `PartialEq` in `single_match`

3 years agoAuto merge of #7085 - Jarcho:manual_map_autoderef, r=giraffate
bors [Fri, 16 Apr 2021 03:05:52 +0000 (03:05 +0000)]
Auto merge of #7085 - Jarcho:manual_map_autoderef, r=giraffate

Don't allow adjustments for `manual_map`

fixes: #7077

The other option here would be to add the return type to the closure. It would be fine for simple types, but longer types can be rather unwieldy. Could also implement the adjustment manually.

changelog: Don't lint `manual_map` when type adjustments are added. e.g. autoderef

3 years agoFix `single_match`
Jason Newcomb [Fri, 16 Apr 2021 02:05:37 +0000 (22:05 -0400)]
Fix `single_match`
Check for `PartialEq` in addition to `StructuralPartialEq` before suggesting `==`

3 years ago`redundant_pattern_matching` fix inverted boolean when missing `Drop` trait\r\r# Please...
Jason Newcomb [Fri, 2 Apr 2021 23:04:45 +0000 (19:04 -0400)]
`redundant_pattern_matching` fix inverted boolean when missing `Drop` trait\r\r# Please enter the commit message for your changes. Lines starting\r# with '#' will be ignored, and an empty message aborts the commit.\r#\r# Date:      Fri Apr 2 19:04:45 2021 -0400\r#\r# On branch redundant_pattern_matching\r# Your branch is ahead of 'origin/redundant_pattern_matching' by 1 commit.\r#   (use "git push" to publish your local commits)\r#\r# Changes to be committed:\r# modified:   clippy_lints/src/matches.rs\r#\r\r# Please enter the commit message for your changes. Lines starting\r# with '#' will be ignored, and an empty message aborts the commit.\r#\r# Date:      Fri Apr 2 19:04:45 2021 -0400\r#\r# interactive rebase in progress; onto ebc64690d\r# Last commands done (6 commands done):\r#    pick 25d211ad8 Code cleanup and additional std types checked\r#    r 0c71ce56f `redundant_pattern_matching` fix inverted boolean when missing `Drop` trait\r# No commands remaining.\r# You are currently editing a commit while rebasing branch 'redundant_pattern_matching' on 'ebc64690d'.\r#\r# Changes to be committed:\r# modified:   clippy_lints/src/matches.rs\r#

3 years agoImprove `redundant_pattern_matching`
Jason Newcomb [Sun, 3 Jan 2021 19:01:01 +0000 (14:01 -0500)]
Improve `redundant_pattern_matching`
Add a note when the drop order change may result in different behaviour.

3 years agoAuto merge of #7049 - Jarcho:remove_match_path, r=camsteffen
bors [Thu, 15 Apr 2021 23:54:41 +0000 (23:54 +0000)]
Auto merge of #7049 - Jarcho:remove_match_path, r=camsteffen

Remove `match_path` and `match_qpath`

The only remaining usage is the `author` lint, so the functions are left in for now. The test result for `repl_uninit` changed, the lint was broken before.

The `collapsible_span_lint_calls` and `match_type_on_diag_item` tests have been changed. Both lints were broken when utils was extracted into it's own crate. `match_type_on_diag_item` isn't quite fixed, but it's at least less broken.

changelog: None

3 years agoRemove all usages of `match_path`, `match_qpath` and `match_path_ast` except the...
Jason Newcomb [Wed, 7 Apr 2021 20:19:25 +0000 (16:19 -0400)]
Remove all usages of `match_path`, `match_qpath` and `match_path_ast` except the `author` lint.
Add note to fix `MATCH_TYPE_ON_DIAG_ITEM`
Add false negative test for `uninit_assumed_init`

3 years agoAuto merge of #7090 - camsteffen:pre-expansion-note, r=Manishearth
bors [Thu, 15 Apr 2021 19:43:58 +0000 (19:43 +0000)]
Auto merge of #7090 - camsteffen:pre-expansion-note, r=Manishearth

Add a note for pre-expansion passes

changelog: none

Just had to turn away a PR for using pre-expansion. I don't think that was the first time. So hopefully this will inform people sooner.

r? flip1995

3 years agoAdd note for pre-expansion passes
Cameron Steffen [Thu, 15 Apr 2021 17:57:31 +0000 (12:57 -0500)]
Add note for pre-expansion passes

3 years agoDon't allow adjustments for `manual_map`
Jason Newcomb [Thu, 15 Apr 2021 14:37:42 +0000 (10:37 -0400)]
Don't allow adjustments for `manual_map`

3 years agoMinor cleanup of `map_entry` and a few additional tests.
Jason Newcomb [Tue, 30 Mar 2021 00:17:03 +0000 (20:17 -0400)]
Minor cleanup of `map_entry` and a few additional tests.

3 years ago`map_entry` improvements
Jason Newcomb [Thu, 25 Mar 2021 13:47:56 +0000 (09:47 -0400)]
`map_entry` improvements
Suggest using `or_insert_with` when possible

3 years ago`map_entry` improvements
Jason Newcomb [Thu, 25 Mar 2021 13:36:38 +0000 (09:36 -0400)]
`map_entry` improvements
Lint `if _.[!]contains_key(&_) { .. } else { .. }` so long as one of the branches contains an insertion.

3 years agoImprove `map_entry` lint
Jason Newcomb [Thu, 25 Mar 2021 13:25:04 +0000 (09:25 -0400)]
Improve `map_entry` lint
Fix false positives where the map is used before inserting into the map.
Fix false positives where two insertions happen.
Suggest using `if let Entry::Vacant(e) = _.entry(_)` when `or_insert` might be a semantic change

3 years agoPR suggestions and removing utils::parent_node_is_if_expr
xFrednet [Wed, 14 Apr 2021 17:40:51 +0000 (19:40 +0200)]
PR suggestions and removing utils::parent_node_is_if_expr

3 years agoAdded inferred local type comparion to SpanlessEq
xFrednet [Tue, 13 Apr 2021 20:55:47 +0000 (22:55 +0200)]
Added inferred local type comparion to SpanlessEq

3 years agoFixed website inline code background
xFrednet [Tue, 13 Apr 2021 18:38:07 +0000 (20:38 +0200)]
Fixed website inline code background

3 years agoparent_node_is_if_expr now also recognizes if let as parent if
xFrednet [Sat, 10 Apr 2021 12:45:51 +0000 (14:45 +0200)]
parent_node_is_if_expr now also recognizes if let as parent if

3 years agoAuto merge of #7070 - camsteffen:changelog-stderr, r=flip1995
bors [Wed, 14 Apr 2021 08:25:14 +0000 (08:25 +0000)]
Auto merge of #7070 - camsteffen:changelog-stderr, r=flip1995

Fix changelog check output

Error messages are more helpful if you can see them.

changelog: none

3 years agoAuto merge of #7039 - phansch:melt-ice, r=flip1995
bors [Wed, 14 Apr 2021 04:53:24 +0000 (04:53 +0000)]
Auto merge of #7039 - phansch:melt-ice, r=flip1995

tabs_in_doc_comments: Fix ICE due to char indexing

This is a quick-fix for an ICE in `tabs_in_doc_comments`. The problem
was that we we're indexing into possibly multi-byte characters, such as '位'.

More specifically `get_chunks_of_tabs` was returning indices into
multi-byte characters. Those were passed on to a `Span` creation that
then caused the ICE.

This fix makes sure that we don't return indices that point inside a
multi-byte character. *However*, we are still iterating over unicode
codepoints, not grapheme clusters. So a seemingly single character like y̆ ,
which actually consists of two codepoints, will probably still cause
incorrect spans in the output. But I don't think we handle those cases
anywhere in Clippy currently?

Fixes #5835

changelog: Fix ICE in `tabs_in_doc_comments`

3 years agoAuto merge of #7076 - rail-rain:missing_const_for_fn, r=phansch
bors [Wed, 14 Apr 2021 04:39:25 +0000 (04:39 +0000)]
Auto merge of #7076 - rail-rain:missing_const_for_fn, r=phansch

Fix a FP in `missing_const_for_fn`

where a function that calls a standard library function whose constness
is unstable is considered as being able to be a const function. Fixes #5995.

The core change is the move from `rustc_mir::const_eval::is_min_const_fn` to `rustc_mir::const_eval::is_const_fn`. I'm not clear about the difference in their purpose between them so I'm not sure if it's acceptable to call `qualify_min_const_fn::is_min_const_fn` this way now.

---

changelog: `missing_const_for_fn`: No longer lints when an unstably const function is called

3 years agoExplain why we use `char_indices()` instead of `chars()`
Philipp Hansch [Wed, 14 Apr 2021 04:30:51 +0000 (06:30 +0200)]
Explain why we use `char_indices()` instead of `chars()`

3 years agoFix a FP in `missing_const_for_fn`
rail [Tue, 13 Apr 2021 05:13:49 +0000 (17:13 +1200)]
Fix a FP in `missing_const_for_fn`

where a function that calls a standard library function whose constness
is unstable is considered as being able to be a const function

3 years agoAuto merge of #7074 - camsteffen:diag-methods, r=llogiq
bors [Tue, 13 Apr 2021 20:31:22 +0000 (20:31 +0000)]
Auto merge of #7074 - camsteffen:diag-methods, r=llogiq

Split `is_diagnostic_assoc_item`

changelog: none

* Split `is_diagnostic_assoc_item` into `is_diag_item_method` and `is_diag_trait_item`
  * `is_diag_item_method` is a bit more nuanced with the `tcx.type_of(impl_id).ty_adt_def()` step, so it seems better to keep that separate.
  * No need to generalize over traits and Adt's since we know which one we want at compile time
  * "item" vs. "method" because a trait may have associated items.
* Replaces the usage of the `sym::slice` diagnostic item with the `slice_alloc` lang item. The diagnostic item should be removed from rustc because it is on the `slice_alloc` impl, not slice itself (and it's not needed).

3 years agoImprove changelog check error handling
Cameron Steffen [Mon, 12 Apr 2021 19:13:42 +0000 (14:13 -0500)]
Improve changelog check error handling

3 years agoRefactor diagnostic item methods
Cameron Steffen [Mon, 12 Apr 2021 23:01:32 +0000 (18:01 -0500)]
Refactor diagnostic item methods

3 years agoAuto merge of #7068 - boxdot:remove-std-ptr-null, r=camsteffen
bors [Mon, 12 Apr 2021 18:37:31 +0000 (18:37 +0000)]
Auto merge of #7068 - boxdot:remove-std-ptr-null, r=camsteffen

Remove paths::STD_PTR_NULL

Related to #5393

changelog: none

3 years agoAuto merge of #7067 - TaKO8Ki:fix-false-negative-on-needless-return, r=llogiq
bors [Mon, 12 Apr 2021 18:00:38 +0000 (18:00 +0000)]
Auto merge of #7067 - TaKO8Ki:fix-false-negative-on-needless-return, r=llogiq

Fix a false negative on `needless return`

closes #7042

changelog: fix a false negative on `needless return`

3 years agoRemove paths::STD_PTR_NULL
boxdot [Mon, 12 Apr 2021 16:34:16 +0000 (18:34 +0200)]
Remove paths::STD_PTR_NULL

3 years agoAuto merge of #7064 - ThibsG:WrongSelfFix, r=giraffate
bors [Mon, 12 Apr 2021 14:16:17 +0000 (14:16 +0000)]
Auto merge of #7064 - ThibsG:WrongSelfFix, r=giraffate

Fix FP in `wrong_self_convention` lint

Previously, this lint didn't check into impl block when it was implementing a trait.
Recent improvements (#6924) have moved this check and some impl blocks are now checked but they shouldn't, such as in #7032.

Fixes #7032

changelog: Fix FP when not taking `self` in impl block for `wrong_self_convention` lint

3 years agofix limit_stderr_length error
Takayuki [Mon, 12 Apr 2021 12:58:34 +0000 (21:58 +0900)]
fix limit_stderr_length error

3 years agoadd tests for a false negative on `needless_return`
Takayuki [Mon, 12 Apr 2021 12:37:19 +0000 (21:37 +0900)]
add tests for a false negative on `needless_return`

3 years agofix a false negative on `needless_return`
Takayuki [Mon, 12 Apr 2021 12:36:49 +0000 (21:36 +0900)]
fix a false negative on `needless_return`

3 years agoAuto merge of #6982 - Jarcho:explicit_into_iter_loop_fp, r=flip1995
bors [Mon, 12 Apr 2021 09:45:32 +0000 (09:45 +0000)]
Auto merge of #6982 - Jarcho:explicit_into_iter_loop_fp, r=flip1995

Fix `explicit_into_iter_loop`

fixes: #6900

changelog: Only lint when `into_iter` is an implementation of `IntoIterator`

3 years agoAuto merge of #7047 - camsteffen:lang-ctor, r=flip1995
bors [Mon, 12 Apr 2021 08:52:10 +0000 (08:52 +0000)]
Auto merge of #7047 - camsteffen:lang-ctor, r=flip1995

Introduce `is_lang_ctor`

changelog: none

Replaces `is_some_ctor` and `is_ok_ctor`. Removes many path usages.

3 years agoAuto merge of #7065 - rail-rain:warn_copy_pass_by_ref, r=Manishearth
bors [Mon, 12 Apr 2021 04:38:42 +0000 (04:38 +0000)]
Auto merge of #7065 - rail-rain:warn_copy_pass_by_ref, r=Manishearth

Add a note on the issue #5953

Hello,

I thought it would be better to have a note and warning about this issue considering it introduced an UB in the past even with the "Search on Github" feature.

---

changelog: Add a note on the issue #5953 to the known problems section.

3 years agoAdd a note on the issue #5953
rail [Sat, 10 Apr 2021 05:50:54 +0000 (17:50 +1200)]
Add a note on the issue #5953

3 years agoAuto merge of #7059 - camsteffen:filter-map, r=flip1995
bors [Sun, 11 Apr 2021 18:24:23 +0000 (18:24 +0000)]
Auto merge of #7059 - camsteffen:filter-map, r=flip1995

Deprecate `filter_map`

Since #6591, `filter_map` does not even lint `filter().map()`. The cases that are still linted make no sense IMO. So this just removes/deprecates it.

changelog: Deprecate `filter_map` lint

Closes #3424
Fixes #7050

3 years agoAuto merge of #6905 - ThibsG:fpSingleComponentPathImports5210, r=giraffate
bors [Sun, 11 Apr 2021 14:18:38 +0000 (14:18 +0000)]
Auto merge of #6905 - ThibsG:fpSingleComponentPathImports5210, r=giraffate

Fix FP in `single_component_path_imports` lint

Fix FP in  `single_component_path_imports` lint when the import is reused with `self`, like in `use self::module`.

Fixes #5210

changelog: none

3 years agoFix FP in `wrong_self_convention` lint
ThibsG [Sun, 11 Apr 2021 11:29:08 +0000 (13:29 +0200)]
Fix FP in `wrong_self_convention` lint

3 years agoAuto merge of #7063 - daxpedda:debug-assert-panic, r=Manishearth
bors [Sat, 10 Apr 2021 22:14:06 +0000 (22:14 +0000)]
Auto merge of #7063 - daxpedda:debug-assert-panic, r=Manishearth

Fix false-positive `debug_assert` in `panic`

This fixes a false-positive in `clippy::panic` when `debug_assert` is used with a message.

Fixes https://github.com/rust-lang/rust-clippy/issues/7062.

changelog: Fix false-positive in `panic` when `debug_assert` is used with a message

3 years agoDeprecate filter_map
Cameron Steffen [Fri, 9 Apr 2021 21:25:39 +0000 (16:25 -0500)]
Deprecate filter_map

3 years agoFix false-positive `debug_assert` in `panic`
daxpedda [Sat, 10 Apr 2021 21:37:18 +0000 (23:37 +0200)]
Fix false-positive `debug_assert` in `panic`

3 years agoAuto merge of #7060 - daxpedda:debug-assert-panic-in-result-fn, r=flip1995
bors [Sat, 10 Apr 2021 19:15:37 +0000 (19:15 +0000)]
Auto merge of #7060 - daxpedda:debug-assert-panic-in-result-fn, r=flip1995

Remove `debug_assert` from `panic_in_result_fn`

I couldn't find any documentation on `debug_assert` that should be remove.
In my humble opinion, I would also like to argue that `todo` and `unreachable` shouldn't trigger this lint?

Related: https://github.com/rust-lang/rust-clippy/issues/6082

r? `@flip1995`

changelog: Change `panic_in_result_fn` to ignore `debug_assert` and co macros

3 years agoFix false-positive `debug_assert`
daxpedda [Sat, 10 Apr 2021 18:54:40 +0000 (20:54 +0200)]
Fix false-positive `debug_assert`

3 years agoFix rustfmt
daxpedda [Sat, 10 Apr 2021 15:45:55 +0000 (17:45 +0200)]
Fix rustfmt

3 years agoRemove `debug_assert` from `panic_in_result_fn`
daxpedda [Sat, 10 Apr 2021 15:38:04 +0000 (17:38 +0200)]
Remove `debug_assert` from `panic_in_result_fn`

3 years agoFix dogfood
Philipp Hansch [Sat, 10 Apr 2021 13:30:51 +0000 (15:30 +0200)]
Fix dogfood

3 years agoFix rustfmt error / Add comment for tab character
Philipp Hansch [Sat, 10 Apr 2021 12:43:52 +0000 (14:43 +0200)]
Fix rustfmt error / Add comment for tab character

3 years agoReplace complex conditional with pattern matching
Philipp Hansch [Sat, 10 Apr 2021 12:42:33 +0000 (14:42 +0200)]
Replace complex conditional with pattern matching

3 years agoHandle imports which are nested directly
ThibsG [Sat, 10 Apr 2021 08:26:53 +0000 (10:26 +0200)]
Handle imports which are nested directly

3 years agoAuto merge of #7056 - jyn514:register-renamed, r=flip1995
bors [Fri, 9 Apr 2021 15:17:36 +0000 (15:17 +0000)]
Auto merge of #7056 - jyn514:register-renamed, r=flip1995

Use `register_renamed` instead of `register_removed` for uplifted lints

This still applies the lint, and also adds a structured suggestion to
rename it.

changelog: Use `register_renamed` instead of `register_removed` for lints uplifted to rustc

3 years agoUse `register_renamed` instead of `register_removed` for uplifted lints
Joshua Nelson [Fri, 9 Apr 2021 14:09:06 +0000 (10:09 -0400)]
Use `register_renamed` instead of `register_removed` for uplifted lints

This still applies the lint, and also adds a structured suggestion to
rename it.

3 years agoAuto merge of #7023 - boxdot:invalid-null-usage-v2, r=camsteffen
bors [Thu, 8 Apr 2021 21:00:48 +0000 (21:00 +0000)]
Auto merge of #7023 - boxdot:invalid-null-usage-v2, r=camsteffen

Invalid null usage v2

This is continuation of #6192 after inactivity.

I plan to move paths into the compiler as diagnostic items after this is merged.

fixes #1703
changelog: none

3 years agoAdd invalid null pointer usage lint.
boxdot [Sun, 18 Oct 2020 11:42:09 +0000 (13:42 +0200)]
Add invalid null pointer usage lint.

3 years agoAuto merge of #7022 - Jarcho:macro_use_import_ice, r=flip1995
bors [Thu, 8 Apr 2021 16:04:55 +0000 (16:04 +0000)]
Auto merge of #7022 - Jarcho:macro_use_import_ice, r=flip1995

Fix `macro_use_import` ICE

fixes: #7015
changelog: Fix `macro_use_import` ICE

3 years agoAuto merge of #7051 - flip1995:rustup, r=flip1995
bors [Thu, 8 Apr 2021 15:46:38 +0000 (15:46 +0000)]
Auto merge of #7051 - flip1995:rustup, r=flip1995

Rustup

changelog: none

r? `@ghost`

3 years agoBump nightly version -> 2021-04-08
flip1995 [Thu, 8 Apr 2021 15:37:06 +0000 (17:37 +0200)]
Bump nightly version -> 2021-04-08

3 years agoMerge remote-tracking branch 'upstream/master' into rustup
flip1995 [Thu, 8 Apr 2021 15:18:19 +0000 (17:18 +0200)]
Merge remote-tracking branch 'upstream/master' into rustup

3 years agoRollup merge of #83916 - Amanieu:asm_anonconst, r=petrochenkov
Dylan DPC [Wed, 7 Apr 2021 11:07:14 +0000 (13:07 +0200)]
Rollup merge of #83916 - Amanieu:asm_anonconst, r=petrochenkov

Use AnonConst for asm! constants

This replaces the old system which used explicit promotion. See #83169 for more background.

The syntax for `const` operands is still the same as before: `const <expr>`.

Fixes #83169

Because the implementation is heavily based on inline consts, we suffer from the same issues:
- We lose the ability to use expressions derived from generics. See the deleted tests in `src/test/ui/asm/const.rs`.
- We are hitting the same ICEs as inline consts, for example #78174. It is unlikely that we will be able to stabilize this before inline consts are stabilized.

3 years agoAuto merge of #7046 - camsteffen:symbol-optimize, r=giraffate
bors [Wed, 7 Apr 2021 04:36:31 +0000 (04:36 +0000)]
Auto merge of #7046 - camsteffen:symbol-optimize, r=giraffate

Some symbol optimizations

changelog: none

3 years agoIntroduce is_lang_ctor
Cameron Steffen [Fri, 2 Apr 2021 22:09:58 +0000 (17:09 -0500)]
Introduce is_lang_ctor

3 years agoSymbol optimizations
Cameron Steffen [Wed, 24 Mar 2021 14:31:43 +0000 (09:31 -0500)]
Symbol optimizations

3 years agoAuto merge of #7044 - camsteffen:match-path, r=Manishearth
bors [Tue, 6 Apr 2021 17:41:34 +0000 (17:41 +0000)]
Auto merge of #7044 - camsteffen:match-path, r=Manishearth

Soft deprecate match_path and match_qpath

changelog: none

From zulip [disucssion](https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/match_.5Bq.5Dpath.20is.20bad.3F).

3 years agoAuto merge of #7043 - camsteffen:dead-utils, r=flip1995
bors [Tue, 6 Apr 2021 16:49:42 +0000 (16:49 +0000)]
Auto merge of #7043 - camsteffen:dead-utils, r=flip1995

Remove some dead utils

changelog: none

3 years agoSoft deprecate match_path and match_qpath
Cameron Steffen [Tue, 6 Apr 2021 13:56:14 +0000 (08:56 -0500)]
Soft deprecate match_path and match_qpath

3 years agoRemove paths::PATH_BUF
Cameron Steffen [Thu, 1 Apr 2021 15:24:44 +0000 (10:24 -0500)]
Remove paths::PATH_BUF

3 years agoRemove get_node_span
Cameron Steffen [Thu, 1 Apr 2021 14:51:31 +0000 (09:51 -0500)]
Remove get_node_span

3 years agoFix `explicit_into_iter_loop`
Jason Newcomb [Sat, 27 Mar 2021 02:28:59 +0000 (22:28 -0400)]
Fix `explicit_into_iter_loop`
Only lint when `into_iter` is an implementation of `IntoIterator`
Minor cleanups

3 years agoAuto merge of #6931 - Jarcho:needless_borrow, r=phansch,flip1995
bors [Tue, 6 Apr 2021 15:30:48 +0000 (15:30 +0000)]
Auto merge of #6931 - Jarcho:needless_borrow, r=phansch,flip1995

Fix all occurences `needless_borrow` internally

The bug that got 'needless_borrow' moved into the nursery was fixed two years ago in d4370f8b.

This did trigger over a thousand times internally, so that's all the other changes. I vetted most of them, but there's a lot The only interesting change is to the lint list. `declare_tool_lint` already makes a reference, so there's no need to take a reference to the lints.

changelog: None

3 years agoFix all occurences of `needless_borrow` internally
Jason Newcomb [Fri, 2 Apr 2021 21:35:32 +0000 (17:35 -0400)]
Fix all occurences of `needless_borrow` internally

3 years agoAuto merge of #7036 - horacimacias:master, r=giraffate
bors [Tue, 6 Apr 2021 13:38:08 +0000 (13:38 +0000)]
Auto merge of #7036 - horacimacias:master, r=giraffate

consider mutability on useless_vec suggestions

fixes #7035

changelog: Now the suggested by `useless_vec` considers mutability to suggest either `&[]`, as before, or `&mut []` if the used reference is mutable.