]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoChange `unnecessary_to_owned` `into_iter` suggestions to `MaybeIncorrect`
Samuel E. Moelius III [Thu, 30 Dec 2021 23:43:34 +0000 (18:43 -0500)]
Change `unnecessary_to_owned` `into_iter` suggestions to `MaybeIncorrect`

2 years agoAuto merge of #8196 - flip1995:rustup, r=flip1995
bors [Thu, 30 Dec 2021 13:22:47 +0000 (13:22 +0000)]
Auto merge of #8196 - flip1995:rustup, r=flip1995

Rustup

r? `@ghost`

changelog: none

2 years agoBump nightly version -> 2021-12-30
flip1995 [Thu, 30 Dec 2021 13:18:01 +0000 (14:18 +0100)]
Bump nightly version -> 2021-12-30

2 years agoMerge remote-tracking branch 'upstream/master' into rustup
flip1995 [Thu, 30 Dec 2021 13:04:13 +0000 (14:04 +0100)]
Merge remote-tracking branch 'upstream/master' into rustup

2 years agoAuto merge of #8117 - hotate29:issue7320, r=camsteffen
bors [Tue, 28 Dec 2021 22:15:53 +0000 (22:15 +0000)]
Auto merge of #8117 - hotate29:issue7320, r=camsteffen

update: ```Sugg::not()``` replacing the comparison operator. #7320

fixes #7320

changelog: ```needless_bool```: Changed to make a smart suggestion.

2 years agoAuto merge of #8183 - alex-ozdemir:limit-ident, r=camsteffen
bors [Tue, 28 Dec 2021 22:01:57 +0000 (22:01 +0000)]
Auto merge of #8183 - alex-ozdemir:limit-ident, r=camsteffen

Limit the ``[`identity_op`]`` lint to integral operands.

changelog: limit ``[`identity_op`]`` to integral operands

In the ``[`identity_op`]`` lint, if the operands are non-integers, then the lint is likely
wrong.

2 years agoAuto merge of #8187 - ApamNapat:fix_7651, r=llogiq
bors [Tue, 28 Dec 2021 17:11:40 +0000 (17:11 +0000)]
Auto merge of #8187 - ApamNapat:fix_7651, r=llogiq

Fixed issues with to_radians and to_degrees lints

fixes #7651

I fixed the original problem as described in the issue, but the bug remains for complex expressions (the commented out TC I added is an example). I would also love some feedback on how to cleanup my code and reduce duplication. I hope it's not a problem that the issue has been claimed by someone else - that was over two months ago.

changelog: ``[`suboptimal_flops`]`` no longer proposes broken code with `to_radians` and `to_degrees`

2 years agoFixed issues with to_radians and to_degrees lints
BB [Tue, 28 Dec 2021 16:45:43 +0000 (17:45 +0100)]
Fixed issues with to_radians and to_degrees lints

2 years agocontants peel_refs to catch `x << &0`
Alex Ozdemir [Tue, 28 Dec 2021 16:32:55 +0000 (08:32 -0800)]
contants peel_refs to catch `x << &0`

2 years agotest
Alex Ozdemir [Tue, 28 Dec 2021 16:19:47 +0000 (08:19 -0800)]
test

2 years agoAuto merge of #8127 - dswij:8090, r=xFrednet
bors [Tue, 28 Dec 2021 12:01:21 +0000 (12:01 +0000)]
Auto merge of #8127 - dswij:8090, r=xFrednet

Fix `enum_variants` FP on prefixes that are not camel-case

closes #8090

Fix FP on `enum_variants` when prefixes are only a substring of a camel-case word. Also adds some util helpers on `str_utils` to help parsing camel-case strings.

This changes how the lint behaves:

1. previously if the Prefix is only a length of 1, it's going to get ignored, i.e. these were previously ignored and now is warned
```rust
enum Foo {
    cFoo,
    cBar,
    cBaz,
}

enum Something {
    CCall,
    CCreate,
    CCryogenize,
}
```

2. non-ascii characters that doesn't have casing will not be split,
```rust
enum NonCaps {
    PrefixXXX,
    PrefixTea,
    PrefixCake,
}
```
will be considered as `PrefixXXX`, `Prefix`, `Prefix`, so this won't lint as opposed to fired previously.

changelog: [`enum_variant_names`] Fix FP when first prefix are only a substring of a camel-case word.

---

 (Edited by `@xFrednet` removed some non ascii characters)

2 years agoAuto merge of #8185 - dswij:8177, r=llogiq
bors [Tue, 28 Dec 2021 11:15:53 +0000 (11:15 +0000)]
Auto merge of #8185 - dswij:8177, r=llogiq

`needless_return` suggest return unit type on void returns

closes #8177

previously, `needless_return` suggests an empty block `{}` to replace void `return` on match arms, this PR improve the suggestion by suggesting a unit instead.

changelog: `needless_return` suggests `()` instead of `{}` on match arms

2 years ago`needless_return` suggest return unit type on void returns
bors [Tue, 28 Dec 2021 11:15:53 +0000 (11:15 +0000)]
`needless_return` suggest return unit type on void returns

closes #8177

previously, `needless_return` suggests an empty block `{}` to replace void `return` on match arms, this PR improve the suggestion by suggesting a unit instead.

changelog: `needless_return` suggests `()` instead of `{}` on match arms

2 years agoAuto merge of #8175 - Kage-Yami:feature/document-8145, r=llogiq
bors [Tue, 28 Dec 2021 09:29:08 +0000 (09:29 +0000)]
Auto merge of #8175 - Kage-Yami:feature/document-8145, r=llogiq

Readme: note that config changes don't apply to already compiled code

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

changelog: added a note to the Readme that config changes don't apply to already compiled code

2 years agoReadme: note that config changes don't apply to already compiled code
bors [Tue, 28 Dec 2021 09:29:08 +0000 (09:29 +0000)]
Readme: note that config changes don't apply to already compiled code

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

changelog: added a note to the Readme that config changes don't apply to already compiled code

2 years agoAuto merge of #8182 - rust-lang:cache-test-items, r=giraffate
bors [Tue, 28 Dec 2021 05:50:20 +0000 (05:50 +0000)]
Auto merge of #8182 - rust-lang:cache-test-items, r=giraffate

cache test item names

This avoids quadratic behavior (collecting all test item names for each `eq_op` instance within the module). However, it invests a good deal of memory to buy this speedup. If that becomes a problem, I may need to change the cache to only store the chain of last visited modules.

This hopefully fixes #8171.

---

changelog: none

2 years agocache test item names
Andre Bogus [Mon, 27 Dec 2021 23:13:03 +0000 (00:13 +0100)]
cache test item names

2 years agoAuto merge of #8181 - ApamNapat:typos_fixes, r=giraffate
bors [Tue, 28 Dec 2021 00:29:24 +0000 (00:29 +0000)]
Auto merge of #8181 - ApamNapat:typos_fixes, r=giraffate

Fixed some typos in README and CONTRIBUTING

changelog: none

2 years agoLimit the identity_op lint to integral operands.
Alex Ozdemir [Tue, 28 Dec 2021 00:06:27 +0000 (16:06 -0800)]
Limit the identity_op lint to integral operands.

If operands are being applied to non-integers, then the lint is likely
wrong.

2 years agoFixed some typos in README and CONTRIBUTING
BB [Mon, 27 Dec 2021 23:08:25 +0000 (00:08 +0100)]
Fixed some typos in README and CONTRIBUTING

2 years agoAuto merge of #8170 - rust-lang:numbered-fields, r=xFrednet
bors [Mon, 27 Dec 2021 21:02:15 +0000 (21:02 +0000)]
Auto merge of #8170 - rust-lang:numbered-fields, r=xFrednet

new lint: `init-numbered-fields`

This fixes #7985.

r? `@xFrednet`

---

changelog: new lint: [`init_numbered_fields`]

2 years agoAuto merge of #8175 - Kage-Yami:feature/document-8145, r=llogiq
bors [Mon, 27 Dec 2021 20:43:48 +0000 (20:43 +0000)]
Auto merge of #8175 - Kage-Yami:feature/document-8145, r=llogiq

Readme: note that config changes don't apply to already compiled code

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

changelog: added a note to the Readme that config changes don't apply to already compiled code

2 years agoReadme: note that config changes don't apply to already compiled code
bors [Mon, 27 Dec 2021 20:43:48 +0000 (20:43 +0000)]
Readme: note that config changes don't apply to already compiled code

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

changelog: added a note to the Readme that config changes don't apply to already compiled code

2 years agonew lint: `init-numbered-fields`
Andre Bogus [Sat, 25 Dec 2021 15:52:58 +0000 (16:52 +0100)]
new lint: `init-numbered-fields`

2 years agoAuto merge of #8133 - surechen:fix_8128, r=xFrednet
bors [Sun, 26 Dec 2021 14:05:35 +0000 (14:05 +0000)]
Auto merge of #8133 - surechen:fix_8128, r=xFrednet

Fix 8128

Fixes #8128

changelog: Fix  error suggestion of `skip(..).next()` for immutable variable.

2 years agoFixes #8128
surechen [Fri, 17 Dec 2021 02:03:59 +0000 (10:03 +0800)]
Fixes #8128

changelog: Fix error suggestion of skip(..).next() for immutable variable.

2 years agoAdd limitation description for `enum_variant_names`
dswij [Fri, 24 Dec 2021 04:32:12 +0000 (12:32 +0800)]
Add limitation description for `enum_variant_names`

`enum_variant_names` will consider characters with no case to be a part
of prefixes/suffixes substring that are compared. This means `Foo1` and
`Foo2` has different prefixes (`Foo1` and `Foo2` prefix respeectively).
This applies to all non-ascii characters with no casing.

2 years agoSome minor cleanup
dswij [Fri, 24 Dec 2021 04:10:34 +0000 (12:10 +0800)]
Some minor cleanup

2 years agoFix reversed suggestion on postfix
dswij [Thu, 23 Dec 2021 05:55:41 +0000 (13:55 +0800)]
Fix reversed suggestion on postfix

2 years agoUpdate str_utils test
dswij [Thu, 23 Dec 2021 03:32:04 +0000 (11:32 +0800)]
Update str_utils test

2 years agoupdate `enum_variants` test
dswij [Wed, 22 Dec 2021 09:04:48 +0000 (17:04 +0800)]
update `enum_variants` test

2 years agoAdd str_util helpers to split camelcase strings
dswij [Wed, 22 Dec 2021 15:18:24 +0000 (23:18 +0800)]
Add str_util helpers to split camelcase strings

2 years agoFix False Positive on `enum_variants` when prefixes are not camel-case
dswij [Wed, 22 Dec 2021 15:18:11 +0000 (23:18 +0800)]
Fix False Positive on `enum_variants` when prefixes are not camel-case

2 years agoRefactor `enum_variants`
dswij [Wed, 15 Dec 2021 04:08:13 +0000 (12:08 +0800)]
Refactor `enum_variants`

2 years agoAuto merge of #8167 - rust-lang:fix-8166, r=xFredNet
bors [Sat, 25 Dec 2021 13:38:08 +0000 (13:38 +0000)]
Auto merge of #8167 - rust-lang:fix-8166, r=xFredNet

fix an ICE on unwrapping a None

This very likely fixes #8166 though I wasn't able to meaningfully reduce a test case. This line is the only call to `unwrap` within that function, which was the one in the stack trace that triggered the ICE, so I think we'll be OK.

`@hackmad` can you pull and build this branch and check if it indeed fixes your problem?

---

changelog: Fixed ICE in [`unnecessary_cast`]

2 years agofix an ICE on unwrapping a None
Andre Bogus [Sat, 25 Dec 2021 12:11:54 +0000 (13:11 +0100)]
fix an ICE on unwrapping a None

2 years agoAuto merge of #8165 - ebobrow:shadow_reuse_fn, r=xFrednet
bors [Sat, 25 Dec 2021 11:58:25 +0000 (11:58 +0000)]
Auto merge of #8165 - ebobrow:shadow_reuse_fn, r=xFrednet

fix [`shadow_reuse`] false negative for if let bindings

fixes #8087

changelog: trigger [`shadow_reuse`] instead of [`shadow_unrelated`] on shadowed `if let` bindings

2 years agofix `shadow_reuse` false negative for if let bindings
Elliot Bobrow [Fri, 24 Dec 2021 21:20:40 +0000 (13:20 -0800)]
fix `shadow_reuse` false negative for if let bindings

2 years agoChange to enclose both sides of Range in parentheses.
hotate29 [Tue, 21 Dec 2021 12:45:55 +0000 (21:45 +0900)]
Change to enclose both sides of Range in parentheses.

2 years agoChange ```floating_point_arthmetic::detect_hypot()``` to enclose the expression in...
hotate29 [Fri, 24 Dec 2021 14:54:15 +0000 (23:54 +0900)]
Change ```floating_point_arthmetic::detect_hypot()``` to enclose the expression in parentheses.

2 years agoUse helper functions in ```Sugg``` tests.
hotate29 [Tue, 21 Dec 2021 13:20:58 +0000 (22:20 +0900)]
Use helper functions in ```Sugg``` tests.

2 years agorefactor ```Sugg::BinOp```
hotate29 [Wed, 15 Dec 2021 14:23:36 +0000 (23:23 +0900)]
refactor ```Sugg::BinOp```

2 years agoAdd test
hotate29 [Tue, 14 Dec 2021 12:27:55 +0000 (21:27 +0900)]
Add test

2 years agoAuto merge of #8163 - pmnoxx:piotr-improve-unwrap-or-default, r=Manishearth
bors [Fri, 24 Dec 2021 12:34:09 +0000 (12:34 +0000)]
Auto merge of #8163 - pmnoxx:piotr-improve-unwrap-or-default, r=Manishearth

Improve `unwrap_or_else_default` when handling `unwrap_or_else(XXX::new)`

changelog:  change `unwrap_or_else_default` to work with std constructors like `Vec::new`, `HashSet::new`, `HashMap::new`.

Notes:
- Code to handle detecting those constructors is already there. I moved it out to `is_default_equivalent_call`

2 years agoSimplify code
Piotr Mikulski [Fri, 24 Dec 2021 06:12:08 +0000 (22:12 -0800)]
Simplify code

2 years agoRefactor
Piotr Mikulski [Fri, 24 Dec 2021 06:00:14 +0000 (22:00 -0800)]
Refactor

2 years agoclippy
Piotr Mikulski [Fri, 24 Dec 2021 05:47:31 +0000 (21:47 -0800)]
clippy

2 years agorefactor
Piotr Mikulski [Fri, 24 Dec 2021 05:46:21 +0000 (21:46 -0800)]
refactor

2 years agocargo dev fmt
Piotr Mikulski [Fri, 24 Dec 2021 05:44:13 +0000 (21:44 -0800)]
cargo dev fmt

2 years agoFix tests
Piotr Mikulski [Fri, 24 Dec 2021 05:43:30 +0000 (21:43 -0800)]
Fix tests

2 years agoFix tests
Piotr Mikulski [Fri, 24 Dec 2021 05:42:56 +0000 (21:42 -0800)]
Fix tests

2 years agorewrite the PR
Piotr Mikulski [Fri, 24 Dec 2021 05:41:00 +0000 (21:41 -0800)]
rewrite the PR

2 years agoImrpove `unwrap_or_else_default`
Piotr Mikulski [Fri, 24 Dec 2021 03:13:57 +0000 (19:13 -0800)]
Imrpove `unwrap_or_else_default`

2 years agoAuto merge of #8144 - Gh0stm4chine:master, r=xFrednet
bors [Thu, 23 Dec 2021 10:06:17 +0000 (10:06 +0000)]
Auto merge of #8144 - Gh0stm4chine:master, r=xFrednet

Add suggestion for neg_multiply lint

This fixes #8115 by adding a suggestion for [neg_multiply].

My first issue on Github, any feedback or input is welcome 😃

changelog: create a suggestion for `neg_multiply`

2 years agoAdd allow unused
Oussama [Thu, 23 Dec 2021 09:45:16 +0000 (10:45 +0100)]
Add allow unused

2 years agoAdd allow precedence lint to prevent rustfix from failing
Oussama [Thu, 23 Dec 2021 08:22:29 +0000 (09:22 +0100)]
Add allow precedence lint to prevent rustfix from failing

2 years agoBless clippy test.
Mara Bos [Wed, 22 Dec 2021 16:25:44 +0000 (17:25 +0100)]
Bless clippy test.

2 years agoAdd support for suggestion when using an expression
Oussama [Tue, 21 Dec 2021 21:00:14 +0000 (22:00 +0100)]
Add support for suggestion when using an expression

2 years agoadd suggestion for neg_multiply lint
Oussama [Sun, 19 Dec 2021 08:48:25 +0000 (09:48 +0100)]
add suggestion for neg_multiply lint

2 years agoAuto merge of #8150 - flip1995:clippy_utils_test, r=xFrednet
bors [Mon, 20 Dec 2021 22:53:47 +0000 (22:53 +0000)]
Auto merge of #8150 - flip1995:clippy_utils_test, r=xFrednet

Test clippy_utils in CI

r? `@xFrednet` Since you did the last refactor of the `str_utils` functions in #7873

changelog: Make sure tests in `clippy_utils` are passing by testing it in CI

2 years agoTest clippy_utils in CI
flip1995 [Mon, 20 Dec 2021 18:56:06 +0000 (19:56 +0100)]
Test clippy_utils in CI

This makes sure that the tests in clippy_utils are run in CI.

When looking into this I discovered that two tests were failing and
multiple doc tests were failing. This fixes those tests and enables a
few more doc tests.

2 years agoAuto merge of #8138 - r00ster91:safety, r=giraffate
bors [Mon, 20 Dec 2021 00:15:18 +0000 (00:15 +0000)]
Auto merge of #8138 - r00ster91:safety, r=giraffate

Fix `SAFETY` comment tag casing in undocumented_unsafe_blocks

This changes the lint introduced in #7748 to suggest adding a `SAFETY` comment instead of a `Safety` comment.

Searching for `// Safety:` in rust-lang/rust yields 67 results while `// SAFETY:` yields 1072.
I think it's safe to say that this comment tag is written in upper case, just like `TODO`, `FIXME` and so on are. As such I would expect this lint to follow the official convention as well.

Note that I intentionally introduced some casing diversity in `tests/ui/undocumented_unsafe_blocks.rs` to test more cases than just `Safety:`.

changelog: Capitalize `SAFETY` comment in [`undocumented_unsafe_blocks`]

2 years agoAuto merge of #8146 - GuillaumeGomez:must-use-self, r=xFrednet
bors [Sun, 19 Dec 2021 14:54:12 +0000 (14:54 +0000)]
Auto merge of #8146 - GuillaumeGomez:must-use-self, r=xFrednet

Don't emit RETURN_SELF_NOT_MUST_USE lint if `Self` already is marked as `#[must_use]`

New bug discovered with this lint. Hopefully, this is the last one.

---

changelog: none

2 years agoDon't emit RETURN_SELF_NOT_MUST_USE lint if `Self` already is marked as `#[must_use]`
Guillaume Gomez [Sun, 19 Dec 2021 14:10:36 +0000 (15:10 +0100)]
Don't emit RETURN_SELF_NOT_MUST_USE lint if `Self` already is marked as `#[must_use]`

2 years agoAuto merge of #91957 - nnethercote:rm-SymbolStr, r=oli-obk
bors [Sun, 19 Dec 2021 09:31:37 +0000 (09:31 +0000)]
Auto merge of #91957 - nnethercote:rm-SymbolStr, r=oli-obk

Remove `SymbolStr`

This was originally proposed in https://github.com/rust-lang/rust/pull/74554#discussion_r466203544. As well as removing the icky `SymbolStr` type, it allows the removal of a lot of `&` and `*` occurrences.

Best reviewed one commit at a time.

r? `@oli-obk`

2 years agoAuto merge of #8143 - GuillaumeGomez:RETURN_SELF_NOT_MUST_USE, r=xFrednet
bors [Sat, 18 Dec 2021 15:06:09 +0000 (15:06 +0000)]
Auto merge of #8143 - GuillaumeGomez:RETURN_SELF_NOT_MUST_USE, r=xFrednet

Ensure that RETURN_SELF_NOT_MUST_USE is not emitted if the method already has `#[must_use]`

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

---

Edit:

changelog: none

(The lint is not in beta yet, this should therefore not be included inside the changelog :) )

2 years agoEnsure that RETURN_SELF_NOT_MUST_USE is not emitted if the method already has a must_...
Guillaume Gomez [Sat, 18 Dec 2021 14:26:16 +0000 (15:26 +0100)]
Ensure that RETURN_SELF_NOT_MUST_USE is not emitted if the method already has a must_use attribute

2 years agoAuto merge of #89841 - cormacrelf:let-else-typed, r=nagisa
bors [Fri, 17 Dec 2021 22:12:34 +0000 (22:12 +0000)]
Auto merge of #89841 - cormacrelf:let-else-typed, r=nagisa

Implement let-else type annotations natively

Tracking issue: #87335

Fixes #89688, fixes #89807, edit: fixes  #89960 as well

As explained in https://github.com/rust-lang/rust/issues/89688#issuecomment-940405082, the previous desugaring moved the let-else scrutinee into a dummy variable, which meant if you wanted to refer to it again in the else block, it had moved.

This introduces a new hir type, ~~`hir::LetExpr`~~ `hir::Let`, which takes over all the fields of `hir::ExprKind::Let(...)` and adds an optional type annotation. The `hir::Let` is then treated like a `hir::Local` when type checking a function body, specifically:

* `GatherLocalsVisitor` overrides a new `Visitor::visit_let_expr` and does pretty much exactly what it does for `visit_local`, assigning a local type to the `hir::Let` ~~(they could be deduplicated but they are right next to each other, so at least we know they're the same)~~
* It reuses the code in `check_decl_local` to typecheck the `hir::Let`, simply returning 'bool' for the expression type after doing that.

* ~~`FnCtxt::check_expr_let` passes this local type in to `demand_scrutinee_type`, and then imitates check_decl_local's pattern checking~~
* ~~`demand_scrutinee_type` (the blindest change for me, please give this extra scrutiny) uses this local type instead of of creating a new one~~
    * ~~Just realised the `check_expr_with_needs` was passing NoExpectation further down, need to pass the type there too. And apparently this Expectation API already exists.~~

Some other misc notes:

* ~~Is the clippy code supposed to be autoformatted? I tried not to give huge diffs but maybe some rustfmt changes simply haven't hit it yet.~~
* in `rustc_ast_lowering/src/block.rs`, I noticed some existing `self.alias_attrs()` calls in `LoweringContext::lower_stmts` seem to be copying attributes from the lowered locals/etc to the statements. Is that right? I'm new at this, I don't know.

2 years agoFix SAFETY comment tag casing in undocumented_unsafe_blocks
r00ster91 [Fri, 17 Dec 2021 19:48:38 +0000 (20:48 +0100)]
Fix SAFETY comment tag casing in undocumented_unsafe_blocks

2 years agoAuto merge of #8137 - flip1995:changelog, r=Manishearth
bors [Fri, 17 Dec 2021 17:01:05 +0000 (17:01 +0000)]
Auto merge of #8137 - flip1995:changelog, r=Manishearth

Fix commits and formatting of CHANGELOG.md

r? `@Manishearth`

Follow up to #8136

I think the beta commit update didn't take the backport we've done into account. I fixed the commit ranges. And while I was at it, I also applied my usual formatting to the changelog entries.

changelog: none

2 years agoFix commits and formatting of CHANGELOG.md
flip1995 [Fri, 17 Dec 2021 15:27:29 +0000 (16:27 +0100)]
Fix commits and formatting of CHANGELOG.md

2 years agoupdate: ```Sugg::not()``` replacing the comparison operator. #7320
hotate29 [Fri, 10 Dec 2021 17:32:23 +0000 (02:32 +0900)]
update: ```Sugg::not()``` replacing the comparison operator. #7320

When inverting an expression, the output is now like ```foo != 0``` instead of ```!(foo == 0)```, the comparison operator is now replaced.

2 years agoAuto merge of #8136 - Manishearth:changelog, r=giraffate
bors [Fri, 17 Dec 2021 14:24:35 +0000 (14:24 +0000)]
Auto merge of #8136 - Manishearth:changelog, r=giraffate

Update changelog

Apologies for the delay!

changelog: none

2 years agoUpdate CHANGELOG.md
Manish Goregaokar [Fri, 17 Dec 2021 14:21:01 +0000 (19:51 +0530)]
Update CHANGELOG.md

Co-authored-by: Takayuki Nakata <f.seasons017@gmail.com>
2 years agoUpdate CHANGELOG.md
Manish Goregaokar [Fri, 17 Dec 2021 14:20:53 +0000 (19:50 +0530)]
Update CHANGELOG.md

Co-authored-by: Takayuki Nakata <f.seasons017@gmail.com>
2 years agoUpdate changelog
Manish Goregaokar [Fri, 17 Dec 2021 13:56:29 +0000 (19:26 +0530)]
Update changelog

2 years agoAuto merge of #8135 - flip1995:backport_remerge, r=flip1995
bors [Fri, 17 Dec 2021 13:52:54 +0000 (13:52 +0000)]
Auto merge of #8135 - flip1995:backport_remerge, r=flip1995

Beta branch remerge

r? `@ghost`

changelog: none

2 years agoMerge remote-tracking branch 'upstream/beta' into backport_remerge
flip1995 [Fri, 17 Dec 2021 13:49:05 +0000 (14:49 +0100)]
Merge remote-tracking branch 'upstream/beta' into backport_remerge

2 years agoMerge commit '23d11428de3e973b34a5090a78d62887f821c90e' into clippyup
flip1995 [Fri, 17 Dec 2021 12:40:22 +0000 (13:40 +0100)]
Merge commit '23d11428de3e973b34a5090a78d62887f821c90e' into clippyup

2 years agoAuto merge of #8134 - flip1995:rustup, r=flip1995
bors [Fri, 17 Dec 2021 12:24:03 +0000 (12:24 +0000)]
Auto merge of #8134 - flip1995:rustup, r=flip1995

Rustup

r? `@ghost`

changelog: none

2 years agoBump nightly version -> 2021-12-17
flip1995 [Fri, 17 Dec 2021 12:22:34 +0000 (13:22 +0100)]
Bump nightly version -> 2021-12-17

2 years agoMerge remote-tracking branch 'upstream/master' into rustup
flip1995 [Fri, 17 Dec 2021 11:22:41 +0000 (12:22 +0100)]
Merge remote-tracking branch 'upstream/master' into rustup

2 years agoAuto merge of #7978 - smoelius:master, r=llogiq
bors [Wed, 15 Dec 2021 10:46:43 +0000 (10:46 +0000)]
Auto merge of #7978 - smoelius:master, r=llogiq

Add `unnecessary_to_owned` lint

This PR adds a lint to check for unnecessary calls to `ToOwned::to_owned` and other similar functions (e.g., `Cow::into_owned`, `ToString::to_string`, etc.).

The lint checks for expressions of the form `&receiver.to_owned_like()` used in a position requiring type `&T` where one of the following is true:
* `receiver`'s type is `T` exactly
* `receiver`'s type implements `Deref<Target = T>`
* `receiver`'s type implements `AsRef<T>`

The lint additionally checks for expressions of the form `receiver.to_owned_like()` used as arguments of type `impl AsRef<T>`.

It would be nice if the lint could also check for expressions used as arguments to functions like the following:
```
fn foo<T: AsRef<str>>(x: T) { ... }
```
However, I couldn't figure out how to determine whether a function input type was instantiated from a parameter with a trait bound.

If someone could offer me some guidance, I would be happy to add such functionality.

Closes #7933

changelog: Add [`unnecessary_to_owned`] lint

2 years agoExpand `is_clone_like` comment
Samuel E. Moelius III [Wed, 15 Dec 2021 10:25:47 +0000 (05:25 -0500)]
Expand `is_clone_like` comment

2 years agoRollup merge of #90521 - jhpratt:stabilize-destructuring_assignment, r=jackh726,pnkfelix
Matthias Krüger [Wed, 15 Dec 2021 07:36:19 +0000 (08:36 +0100)]
Rollup merge of #90521 - jhpratt:stabilize-destructuring_assignment, r=jackh726,pnkfelix

Stabilize `destructuring_assignment`

Closes #71126

- [Stabilization report](https://github.com/rust-lang/rust/issues/71126#issuecomment-941148058)
- [Completed FCP](https://github.com/rust-lang/rust/issues/71126#issuecomment-954914819)

`@rustbot` label +F-destructuring-assignment +T-lang
Also needs +relnotes but I don't have permission to add that tag.

2 years agoRemove unnecessary sigils around `Ident::as_str()` calls.
Nicholas Nethercote [Wed, 15 Dec 2021 05:13:11 +0000 (16:13 +1100)]
Remove unnecessary sigils around `Ident::as_str()` calls.

2 years agoRemove unnecessary sigils around `Symbol::as_str()` calls.
Nicholas Nethercote [Wed, 15 Dec 2021 03:39:23 +0000 (14:39 +1100)]
Remove unnecessary sigils around `Symbol::as_str()` calls.

2 years agoStabilize `destructuring_assignment`
Jacob Pratt [Wed, 3 Nov 2021 06:50:57 +0000 (02:50 -0400)]
Stabilize `destructuring_assignment`

2 years agoRemove `SymbolStr`.
Nicholas Nethercote [Tue, 14 Dec 2021 21:32:21 +0000 (08:32 +1100)]
Remove `SymbolStr`.

By changing `as_str()` to take `&self` instead of `self`, we can just
return `&str`. We're still lying about lifetimes, but it's a smaller lie
than before, where `SymbolStr` contained a (fake) `&'static str`!

2 years agoRollup merge of #91881 - Patrick-Poitras:stabilize-iter-zip, r=scottmcm
Matthias Krüger [Wed, 15 Dec 2021 00:28:08 +0000 (01:28 +0100)]
Rollup merge of #91881 - Patrick-Poitras:stabilize-iter-zip, r=scottmcm

Stabilize `iter::zip`

Hello all!

As the tracking issue (#83574) for `iter::zip` completed the final commenting period without any concerns being raised, I hereby submit this stabilization PR on the issue.

As the pull request that introduced the feature (#82917) states, the `iter::zip` function is a shorter way to zip two iterators. As it's generally a quality-of-life/ergonomic improvement, it has been integrated into the codebase without any trouble, and has been
used in many places across the rust compiler and standard library since March without any issues.

For more details, I would refer to `@cuviper's` original PR, or the [function's documentation](https://doc.rust-lang.org/std/iter/fn.zip.html).

2 years agoRollup merge of #90939 - estebank:wg-af-polish, r=tmandry
Matthias Krüger [Wed, 15 Dec 2021 00:28:04 +0000 (01:28 +0100)]
Rollup merge of #90939 - estebank:wg-af-polish, r=tmandry

Tweak errors coming from `for`-loop, `?` and `.await` desugaring

 * Suggest removal of `.await` on non-`Future` expression
 * Keep track of obligations introduced by desugaring
 * Remove span pointing at method for obligation errors coming from desugaring
 * Point at called local sync `fn` and suggest making it `async`

```
error[E0277]: `()` is not a future
  --> $DIR/unnecessary-await.rs:9:10
   |
LL |     boo().await;
   |     -----^^^^^^ `()` is not a future
   |     |
   |     this call returns `()`
   |
   = help: the trait `Future` is not implemented for `()`
help: do not `.await` the expression
   |
LL -     boo().await;
LL +     boo();
   |
help: alternatively, consider making `fn boo` asynchronous
   |
LL | async fn boo () {}
   | +++++
```

Fix #66731.

2 years agoAddress review comments
Samuel E. Moelius III [Tue, 14 Dec 2021 23:36:19 +0000 (18:36 -0500)]
Address review comments

2 years agoRemove iter::zip feature gate from clippy
PFPoitras [Tue, 14 Dec 2021 22:10:57 +0000 (18:10 -0400)]
Remove iter::zip feature gate from clippy

2 years agoAuto merge of #91728 - Amanieu:stable_asm, r=joshtriplett
bors [Tue, 14 Dec 2021 21:15:22 +0000 (21:15 +0000)]
Auto merge of #91728 - Amanieu:stable_asm, r=joshtriplett

Stabilize asm! and global_asm!

Tracking issue: #72016

It's been almost 2 years since the original [RFC](https://github.com/rust-lang/rfcs/pull/2850) was posted and we're finally ready to stabilize this feature!

The main changes in this PR are:
- Removing `asm!` and `global_asm!` from the prelude as per the decision in #87228.
- Stabilizing the `asm` and `global_asm` features.
- Removing the unstable book pages for `asm` and `global_asm`. The contents are moved to the [reference](https://github.com/rust-lang/reference/pull/1105) and [rust by example](https://github.com/rust-lang/rust-by-example/pull/1483).
  - All links to these pages have been removed to satisfy the link checker. In a later PR these will be replaced with links to the reference or rust by example.
- Removing the automatic suggestion for using `llvm_asm!` instead of `asm!` if you're still using the old syntax, since it doesn't work anymore with `asm!` no longer being in the prelude. This only affects code that predates the old LLVM-style `asm!` being renamed to `llvm_asm!`.
- Updating `stdarch` and `compiler-builtins`.
- Updating all the tests.

r? `@joshtriplett`

2 years agoAdd comma
Samuel E. Moelius III [Mon, 13 Dec 2021 17:27:47 +0000 (12:27 -0500)]
Add comma

2 years agofix clippy tests
Esteban Kuber [Fri, 10 Dec 2021 17:20:57 +0000 (17:20 +0000)]
fix clippy tests

2 years agoFix rebase and clippy tests
Esteban Kuber [Tue, 16 Nov 2021 22:06:25 +0000 (22:06 +0000)]
Fix rebase and clippy tests

2 years agoFix clippy uses of QPath::LangItem
Esteban Kuber [Tue, 16 Nov 2021 20:44:25 +0000 (20:44 +0000)]
Fix clippy uses of QPath::LangItem

2 years agoHandle `to_vec` on for loop expression #8069
Samuel E. Moelius III [Mon, 13 Dec 2021 10:49:43 +0000 (05:49 -0500)]
Handle `to_vec` on for loop expression #8069

2 years agoAddress review comments
Samuel E. Moelius III [Tue, 30 Nov 2021 10:52:01 +0000 (05:52 -0500)]
Address review comments

* Share a list of methods with `implicit_clone`
* Ensure no overlap with `redundant_clone`