]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoAdd `separated_literal_suffix` as an alternative for
Dharma Saputra Wijaya [Wed, 22 Sep 2021 14:13:54 +0000 (22:13 +0800)]
Add `separated_literal_suffix` as an alternative for
`unseparated_literal_suffix`

This commit adds a configuration `literal-suffix-style` to enforce a
specific style for unseparated_literal_suffix. The configuration accepts
two values:
- "separated"
    enforce all literals to be written separately (e.g. `123_i32`)
- "unseparated"
    enforce all literals to be written as unseparated (e.g. `123i32`)

Not specifying a value means that there is no preference on style and
any style should not be warned.

2 years agoChange `unseparated_literal_suffix` type to restriction
dswij [Mon, 27 Sep 2021 06:26:29 +0000 (14:26 +0800)]
Change `unseparated_literal_suffix` type to restriction

2 years agoAuto merge of #7755 - HKalbasi:master, r=xFrednet
bors [Sun, 3 Oct 2021 10:30:16 +0000 (10:30 +0000)]
Auto merge of #7755 - HKalbasi:master, r=xFrednet

exclude enum from derivable impls

fix #7753

changelog: Exclude enum from ``[`derivable_impls`]``

2 years agoChange not enum to is struct
HKalbasi [Sun, 3 Oct 2021 09:31:57 +0000 (13:01 +0330)]
Change not enum to is struct

2 years agoAuto merge of #7709 - Qwaz:drop_non_send, r=xFrednet
bors [Sun, 3 Oct 2021 08:43:32 +0000 (08:43 +0000)]
Auto merge of #7709 - Qwaz:drop_non_send, r=xFrednet

Implement `non_send_field_in_send_ty` lint

changelog: Implement [`non_send_fields_in_send_ty`] lint

Fixes #7703

2 years agoexclude enum from derivable impls
hkalbasi [Sun, 3 Oct 2021 08:28:27 +0000 (11:58 +0330)]
exclude enum from derivable impls

2 years agoUpdate documentation and name for non_send_fields_in_send_ty lint
Yechan Bae [Sat, 2 Oct 2021 23:22:37 +0000 (19:22 -0400)]
Update documentation and name for non_send_fields_in_send_ty lint

2 years agoAuto merge of #7747 - Manishearth:excessive-precision, r=xFrednet
bors [Sat, 2 Oct 2021 16:12:30 +0000 (16:12 +0000)]
Auto merge of #7747 - Manishearth:excessive-precision, r=xFrednet

Correctly handle signs in exponents in numeric_literal::format()

Fixes #7744

changelog: Correctly handle signs in exponents in `numeric_literal::format()`

2 years agoCorrectly handle signs in exponents in numeric_literal::format()
Manish Goregaokar [Sat, 2 Oct 2021 00:27:47 +0000 (17:27 -0700)]
Correctly handle signs in exponents in numeric_literal::format()

2 years agoAdd regression test
Manish Goregaokar [Fri, 1 Oct 2021 23:14:35 +0000 (16:14 -0700)]
Add regression test

2 years agoForgot to bless ui-toml test
Yechan Bae [Fri, 1 Oct 2021 18:26:04 +0000 (14:26 -0400)]
Forgot to bless ui-toml test

2 years agoDo not use full type path in help message
Yechan Bae [Fri, 1 Oct 2021 18:00:50 +0000 (14:00 -0400)]
Do not use full type path in help message

2 years agoAdd ui-test for enable-raw-pointer-heuristic-for-send config
Yechan Bae [Fri, 1 Oct 2021 17:07:25 +0000 (13:07 -0400)]
Add ui-test for enable-raw-pointer-heuristic-for-send config

2 years agoMinor changes from PR feedback
Yechan Bae [Fri, 1 Oct 2021 16:47:54 +0000 (12:47 -0400)]
Minor changes from PR feedback

2 years agoAdd configuration for raw pointer heuristic
Yechan Bae [Tue, 28 Sep 2021 20:55:36 +0000 (16:55 -0400)]
Add configuration for raw pointer heuristic

2 years agoLook into tuple, array, ADT args in raw pointer heuristic
Yechan Bae [Tue, 28 Sep 2021 20:42:27 +0000 (16:42 -0400)]
Look into tuple, array, ADT args in raw pointer heuristic

2 years agoEmit one report for all fields in the same ADT
Yechan Bae [Tue, 28 Sep 2021 19:23:39 +0000 (15:23 -0400)]
Emit one report for all fields in the same ADT

2 years agoUpdate documentation
Yechan Bae [Tue, 28 Sep 2021 17:46:13 +0000 (13:46 -0400)]
Update documentation

2 years agotypo
Yechan Bae [Thu, 23 Sep 2021 10:49:23 +0000 (06:49 -0400)]
typo

2 years agoFix attribute handling
Yechan Bae [Thu, 23 Sep 2021 10:45:24 +0000 (06:45 -0400)]
Fix attribute handling

2 years agoInitial implementation
Yechan Bae [Thu, 23 Sep 2021 07:51:10 +0000 (03:51 -0400)]
Initial implementation

2 years agoAuto merge of #7741 - surechen:fix_if_then_panic, r=flip1995
bors [Fri, 1 Oct 2021 10:04:19 +0000 (10:04 +0000)]
Auto merge of #7741 - surechen:fix_if_then_panic, r=flip1995

Make if_then_panic handle situation of BinOpKind::And || BinOpKind::Or

fixes #7731

Make if_then_panic handle situation of cond.kind = ExprKind::DropTemps(ExprKind::Binary(BinOpKind::And || BinOpKind::Or, left, right), ..) =

changelog: [`if_then_panic`] Fix suggestion for more complex conditions

2 years agouse sugg::Sugg::maybe_par
surechen [Fri, 1 Oct 2021 05:13:09 +0000 (13:13 +0800)]
use sugg::Sugg::maybe_par

2 years agoAuto merge of #7338 - camsteffen:shadow, r=llogic
bors [Thu, 30 Sep 2021 19:08:22 +0000 (19:08 +0000)]
Auto merge of #7338 - camsteffen:shadow, r=llogic

Re-write shadow lints

changelog: Move shadow_unrelated to restriction
changelog: The shadow lints find a lot more shadows and are not limited to certain patterns

Drastically simplifies the implementation. Catches a lot more cases.

I removed the "initialization happens here" note. It is not helpful IMO.

Closes #318
Fixes #2890
Fixes #6563
Fixes #7588
Fixes #7620

2 years agoRemove shadow allows
Cameron Steffen [Mon, 27 Sep 2021 22:19:33 +0000 (17:19 -0500)]
Remove shadow allows

2 years agoRewrite shadow lint
Cameron Steffen [Sun, 10 Jan 2021 23:51:43 +0000 (17:51 -0600)]
Rewrite shadow lint

2 years agoRemove initialization note from shadow lint
Cameron Steffen [Mon, 11 Jan 2021 15:10:24 +0000 (09:10 -0600)]
Remove initialization note from shadow lint

2 years agoMove shadow_unrelated to restriction
Cameron Steffen [Sat, 25 Sep 2021 22:14:34 +0000 (17:14 -0500)]
Move shadow_unrelated to restriction

2 years agoAuto merge of #7677 - surechen:edit_large_enum_variant, r=camsteffen
bors [Thu, 30 Sep 2021 12:45:17 +0000 (12:45 +0000)]
Auto merge of #7677 - surechen:edit_large_enum_variant, r=camsteffen

fix bug for large_enum_variants

Fix the discussion problem in the issue of https://github.com/rust-lang/rust-clippy/issues/7666#issuecomment-919654291

About the false positive problem of case:
```rust
enum LargeEnum6 {
    A,
    B([u8;255]),
    C([u8;200]),
}
```

changelog: Fix largest_enum_variant wrongly identifying the second largest variant.

2 years agofix issue #7731
surechen [Thu, 30 Sep 2021 11:06:42 +0000 (19:06 +0800)]
fix issue #7731

Make if_then_else handle situation of cond.kind = ExprKind::DropTemps(ExprKind::Binary(BinOpKind::And || BinOpKind::Or, left, right), ..) =

2 years agoAuto merge of #7684 - surechen:solve_derivable_impls, r=flip1995
bors [Thu, 30 Sep 2021 08:19:58 +0000 (08:19 +0000)]
Auto merge of #7684 - surechen:solve_derivable_impls, r=flip1995

fix for issue #7683

Fixes #7683.

For Repeat  [x; y] (x is the type and y is the times to repeat) . When y > 32, the compiler will report an error:

https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=7148558162685e91056e0550797ea74c

Because https://github.com/rust-lang/rust/blob/6cdd42f9f8dd4e5e5ba0aa816bc4c99ab8b102f9/library/std/src/primitive_docs.rs#L538
/// Arrays of sizes from 0 to 32 (inclusive) implement [`Default`] trait
/// if the element type allows it. As a stopgap, trait implementations are
/// statically generated up to size 32.

So here to detect this situation.

changelog: [`derivable_impls`]: No longer lints when arrays bigger than 32 elements are involved

2 years agoAuto merge of #7673 - mikerite:include-generated-code, r=giraffate
bors [Thu, 30 Sep 2021 03:58:47 +0000 (03:58 +0000)]
Auto merge of #7673 - mikerite:include-generated-code, r=giraffate

Move code generated by `update_lints` to includes

Move code generated by `update_lints` to includes

changelog: none

2 years agoFix comment in `update_lints`
mikerite [Thu, 30 Sep 2021 03:11:39 +0000 (05:11 +0200)]
Fix comment in `update_lints`

Co-authored-by: Takayuki Nakata <f.seasons017@gmail.com>
2 years agoArrays of sizes from 0 to 32 (inclusive) implement [Default] trait, edit method is_de...
surechen [Sat, 18 Sep 2021 10:35:17 +0000 (18:35 +0800)]
Arrays of sizes from 0 to 32 (inclusive) implement [Default] trait, edit method is_default_equivalent() to satisfy with this.

2 years agofix bug for large_enum_variants
surechen [Thu, 16 Sep 2021 08:42:36 +0000 (16:42 +0800)]
fix bug for large_enum_variants

2 years agoAdd includes to pre-commit hook
Michael Wright [Sat, 18 Sep 2021 04:57:03 +0000 (06:57 +0200)]
Add includes to pre-commit hook

2 years agoAdd test module for `update_lints`
Michael Wright [Sat, 18 Sep 2021 04:43:39 +0000 (06:43 +0200)]
Add test module for `update_lints`

2 years agoMove `update_lints` specific code out of `lib`
Michael Wright [Sat, 18 Sep 2021 04:43:39 +0000 (06:43 +0200)]
Move `update_lints` specific code out of `lib`

2 years agoFix lint register code format
Michael Wright [Sat, 18 Sep 2021 04:43:39 +0000 (06:43 +0200)]
Fix lint register code format

Also change the generation functions to return `String` instead of
`Vec<String>`. This makes sense now as the updates aren't line oriented
anymore.

2 years agoMove code generated by `update_lints` to includes
Michael Wright [Sat, 18 Sep 2021 04:43:39 +0000 (06:43 +0200)]
Move code generated by `update_lints` to includes

2 years agoAuto merge of #7736 - vxpm:master, r=giraffate
bors [Wed, 29 Sep 2021 00:10:49 +0000 (00:10 +0000)]
Auto merge of #7736 - vxpm:master, r=giraffate

Fix typo ("asynx" corrected to "async")

changelog: Fixed small typo in [`await_holding_lock`]'s documentation - "asynx" was corrected to "async"

2 years agoFix typo ("asynx" corrected to "async")
vxpm [Tue, 28 Sep 2021 20:53:12 +0000 (17:53 -0300)]
Fix typo ("asynx" corrected to "async")

2 years agoAuto merge of #7734 - Manishearth:doc-unsafe-trait, r=camsteffen
bors [Tue, 28 Sep 2021 17:09:34 +0000 (17:09 +0000)]
Auto merge of #7734 - Manishearth:doc-unsafe-trait, r=camsteffen

Make `doc_unsafe` warn on unsafe traits as well

Fixes #7732

changelog: Make [`doc_unsafe`] warn on unsafe traits as well

2 years agoAuto merge of #7711 - camsteffen:depinfo-error, r=flip1995
bors [Tue, 28 Sep 2021 16:56:02 +0000 (16:56 +0000)]
Auto merge of #7711 - camsteffen:depinfo-error, r=flip1995

Improve depinfo error

changelog: none

r? `@flip1995`

2 years agoAuto merge of #7733 - flip1995:rustup, r=flip1995
bors [Tue, 28 Sep 2021 16:42:31 +0000 (16:42 +0000)]
Auto merge of #7733 - flip1995:rustup, r=flip1995

Rustup

This needs a review this time. Especially https://github.com/rust-lang/rust-clippy/commit/521bf8f0fa18c7f130505f0a902ab0e65a76cec2 cc `@camsteffen` I think this is necessary now, because `itertools` is no longer a dependency of `clippy_utils` and therefore this path can't be found :thinking:

( I forgot about the sync last week. I should get to document this process better, so other people can do it when I'm not around )

changelog: none

2 years agoCleanup of rustup changes
flip1995 [Tue, 28 Sep 2021 16:40:06 +0000 (17:40 +0100)]
Cleanup of rustup changes

2 years agoBump nightly version -> 2021-09-28
flip1995 [Tue, 28 Sep 2021 09:54:04 +0000 (10:54 +0100)]
Bump nightly version -> 2021-09-28

2 years agoUpdate clippy_lints/src/doc.rs
Manish Goregaokar [Tue, 28 Sep 2021 16:37:11 +0000 (09:37 -0700)]
Update clippy_lints/src/doc.rs

Co-authored-by: Cameron Steffen <cam.steffen94@gmail.com>
2 years agoAllow internal lint INVALID_PATHS for itertools path
flip1995 [Tue, 28 Sep 2021 09:53:11 +0000 (10:53 +0100)]
Allow internal lint INVALID_PATHS for itertools path

Since clippy_utils doesn't depend on the itertools crate anymore, the
lint can't find the path.

2 years agoMake doc_unsafe lint on unsafe traits as well
Manish Goregaokar [Tue, 28 Sep 2021 15:33:58 +0000 (08:33 -0700)]
Make doc_unsafe lint on unsafe traits as well

2 years agoAuto merge of #7727 - flip1995:changelog, r=xFrednet
bors [Tue, 28 Sep 2021 10:27:47 +0000 (10:27 +0000)]
Auto merge of #7727 - flip1995:changelog, r=xFrednet

Update changelog to 1.56

As expected a pretty short changelog, because of the missed sync last release cycle.

[Rendered](https://github.com/flip1995/rust-clippy/blob/changelog/CHANGELOG.md)

changelog: none

2 years agoFix CHANGELOG formatting
flip1995 [Tue, 28 Sep 2021 10:08:40 +0000 (11:08 +0100)]
Fix CHANGELOG formatting

2 years agoMerge remote-tracking branch 'upstream/master' into rustup
flip1995 [Tue, 28 Sep 2021 09:50:56 +0000 (10:50 +0100)]
Merge remote-tracking branch 'upstream/master' into rustup

2 years agoAuto merge of #7608 - andrewpollack:7594/while_let_some_result, r=Manishearth
bors [Tue, 28 Sep 2021 05:33:57 +0000 (05:33 +0000)]
Auto merge of #7608 - andrewpollack:7594/while_let_some_result, r=Manishearth

#7594: Adding new 'while_let_some_result' linting

Excited for the opportunity to contribute to Clippy! Since the latest Bay Area Rust Meetup, I've been looking for an opportunity and found it :smile:

Please let me know how I can improve this PR! Much of it is similar to ``[`if_let_some_result`]``, but I followed the description in the issue to create its own linting rules. Looking forward to feedback, and continuing to work on Clippy in the future!

changelog: Renamed Lint: `if_let_some_result` is now called [`match_result_ok`]. Now also handles `while let` case.

2 years agofmt
Manish Goregaokar [Tue, 28 Sep 2021 05:33:45 +0000 (22:33 -0700)]
fmt

2 years agoAdd renamed lint
Manish Goregaokar [Tue, 28 Sep 2021 05:26:14 +0000 (22:26 -0700)]
Add renamed lint

2 years agoUse a single if_chain
Manish Goregaokar [Tue, 28 Sep 2021 05:09:23 +0000 (22:09 -0700)]
Use a single if_chain

2 years agoAdjusting changelog
Andrew Pollack [Sat, 25 Sep 2021 15:39:00 +0000 (08:39 -0700)]
Adjusting changelog

2 years agoRemoved value from changelog to get pass
Andrew Pollack [Tue, 21 Sep 2021 00:34:32 +0000 (17:34 -0700)]
Removed value from changelog to get pass

2 years agoAdding new linting
Andrew Pollack [Mon, 30 Aug 2021 01:49:09 +0000 (18:49 -0700)]
Adding new  linting

2 years agoUpdate changelog to 1.56
flip1995 [Mon, 27 Sep 2021 09:56:49 +0000 (11:56 +0200)]
Update changelog to 1.56

2 years agoAuto merge of #7664 - matthiaskrgr:bump_to_2021, r=flip1995
bors [Mon, 27 Sep 2021 09:14:10 +0000 (09:14 +0000)]
Auto merge of #7664 - matthiaskrgr:bump_to_2021, r=flip1995

bump clippy crates to edition 2021

Also helps with dogfooding edition 2021 a bit. :)
Tests passed locally.

---

changelog: bump edition from 2018 to 2021

2 years agoAuto merge of #7692 - workingjubilee:float-cmp-not-wrong, r=giraffate
bors [Mon, 27 Sep 2021 09:00:31 +0000 (09:00 +0000)]
Auto merge of #7692 - workingjubilee:float-cmp-not-wrong, r=giraffate

Demote float_cmp to pedantic

See this issue: https://github.com/rust-lang/rust-clippy/issues/7666

This is one of the most frequently suppressed lints. It is deny-by-default. It is not actually clearly wrong, as there are many instances where direct float comparison is actually desirable. It is only after operating on floats that they may lose precision, and that depends greatly on the operation. As most correctness lints have a much higher standard of error, being based on hard and fast binary logic, this should not be amongst them.

A linter is not a substitute for observing the math carefully and running tests, and doing the desirable thing is even more likely to lead one to want exact comparisons.

changelog: Demote [`float_cmp`] from correctness to pedantic lints

2 years agoAuto merge of #7722 - dtolnay-contrib:float, r=giraffate
bors [Mon, 27 Sep 2021 00:49:08 +0000 (00:49 +0000)]
Auto merge of #7722 - dtolnay-contrib:float, r=giraffate

Stop suggesting a float truncation that is not shorter

Fixes #7721.

Previously Clippy would say that a number has excessive precision even if it has the minimum possible precision for the floating point value that it corresponds to.

changelog: Fix [`excessive_precision`] being triggered on floats that are already written in shortest form

2 years agoStop suggesting a float truncation that is not shorter
David Tolnay [Sun, 26 Sep 2021 05:54:08 +0000 (22:54 -0700)]
Stop suggesting a float truncation that is not shorter

2 years agoRollup merge of #89216 - r00ster91:bigo, r=dtolnay
Manish Goregaokar [Sun, 26 Sep 2021 01:22:20 +0000 (18:22 -0700)]
Rollup merge of #89216 - r00ster91:bigo, r=dtolnay

Consistent big O notation

This makes the big O time complexity notation in places with markdown support more consistent.
Inspired by #89210

2 years agoclippy lints: update doctest ranges to inclusive ones
Matthias Krüger [Fri, 10 Sep 2021 21:47:51 +0000 (23:47 +0200)]
clippy lints: update doctest ranges to inclusive ones

2 years agobump clippy crates to edition 2021
Matthias Krüger [Fri, 10 Sep 2021 20:57:00 +0000 (22:57 +0200)]
bump clippy crates to edition 2021

2 years agoAuto merge of #89030 - nbdd0121:box2, r=jonas-schievink
bors [Sat, 25 Sep 2021 11:01:13 +0000 (11:01 +0000)]
Auto merge of #89030 - nbdd0121:box2, r=jonas-schievink

Introduce `Rvalue::ShallowInitBox`

Polished version of #88700.

Implements MCP rust-lang/compiler-team#460, and should allow #43596 to go forward.

In short, creating an empty box is split from a nullary-op `NullOp::Box` into two steps, first a call to `exchange_malloc`, then a `Rvalue::ShallowInitBox` which transmutes `*mut u8` to a shallow-initialized `Box<T>`. This allows the `exchange_malloc` call to unwind. Details can be found in the MCP.

`NullOp::Box` is not yet removed, purely to make reverting easier in case anything goes wrong as the result of this PR. If revert is needed a reversion of "Use Rvalue::ShallowInitBox for box expression" commit followed by a test bless should be sufficient.

Experiments in #88700 showed a very slight compile-time perf regression due to (supposedly) slightly more time spent in LLVM. We could omit unwind edge generation (in non-`oom=panic` case) in box expression MIR construction to restore perf; but I don't think it's necessary since runtime perf isn't affected and perf difference is rather small.

2 years agoIntroduce `Rvalue::ShallowInitBox`
Gary Guo [Mon, 6 Sep 2021 17:33:23 +0000 (18:33 +0100)]
Introduce `Rvalue::ShallowInitBox`

2 years agoRollup merge of #89001 - jackh726:binder-cleanup, r=nikomatsakis
Jubilee [Fri, 24 Sep 2021 18:40:11 +0000 (11:40 -0700)]
Rollup merge of #89001 - jackh726:binder-cleanup, r=nikomatsakis

Be explicit about using Binder::dummy

This is somewhat of a late followup to the binder refactor PR. It removes `ToPredicate` and `ToPolyTraitImpls` that hide the use of `Binder::dummy`. While this does make code a bit more verbose, it allows us be more careful about where we create binders.

Another alternative here might be to add a new trait `ToBinder` or something with a `dummy()` fn. Which could still allow grepping but allows doing something like `trait_ref.dummy()` (but I also wonder if longer-term, it would be better to be even more explicit with a `bind_with_vars(ty::List::empty())` *but* that's not clear yet.

r? ``@nikomatsakis``

2 years agoImprove depinfo error
Cameron Steffen [Thu, 23 Sep 2021 18:14:46 +0000 (13:14 -0500)]
Improve depinfo error

2 years agoAuto merge of #7669 - Labelray:if_then_panic, r=giraffate
bors [Fri, 24 Sep 2021 14:43:51 +0000 (14:43 +0000)]
Auto merge of #7669 - Labelray:if_then_panic, r=giraffate

New lint `if_then_panic`

changelog: add the new lint [`if_then_panic`]
fix #7645

2 years agoAuto merge of #7715 - F3real:vec2, r=camsteffen
bors [Fri, 24 Sep 2021 14:24:41 +0000 (14:24 +0000)]
Auto merge of #7715 - F3real:vec2, r=camsteffen

Avoid needless heap allocation in box_collection

Fix issue left from previous PR

changelog: none.

r? `@Manishearth`

2 years agoAdd new lint `if_then_panic`
Labelray [Tue, 14 Sep 2021 08:28:09 +0000 (16:28 +0800)]
Add new lint `if_then_panic`

2 years agoconsistent big O notation
r00ster91 [Fri, 24 Sep 2021 10:44:28 +0000 (12:44 +0200)]
consistent big O notation

2 years agoAvoid needless heap allocation in box_collection
F3real [Fri, 24 Sep 2021 09:02:16 +0000 (11:02 +0200)]
Avoid needless heap allocation in box_collection

2 years agoAuto merge of #7707 - Jarcho:suspicious_else_proc_mac, r=Manishearth
bors [Thu, 23 Sep 2021 16:14:29 +0000 (16:14 +0000)]
Auto merge of #7707 - Jarcho:suspicious_else_proc_mac, r=Manishearth

Don't lint `suspicious_else_formatting` inside proc-macros

fixes: #7650

I'll add a test for this one soon.

changelog: Don't lint `suspicious_else_formatting` inside proc-macros

2 years agoAdd test for #7650
Jason Newcomb [Thu, 23 Sep 2021 15:17:54 +0000 (11:17 -0400)]
Add test for #7650

2 years agoDon't lint `suspicious_else_formatting` inside proc-macros
Jason Newcomb [Thu, 23 Sep 2021 04:22:27 +0000 (00:22 -0400)]
Don't lint `suspicious_else_formatting` inside proc-macros

2 years agoAuto merge of #89139 - camsteffen:write-perf, r=Mark-Simulacrum
bors [Thu, 23 Sep 2021 02:10:26 +0000 (02:10 +0000)]
Auto merge of #89139 - camsteffen:write-perf, r=Mark-Simulacrum

Use ZST for fmt unsafety

as suggested here - https://github.com/rust-lang/rust/pull/83302#issuecomment-923529151.

2 years agoAuto merge of #7693 - F3real:vec2, r=Manishearth
bors [Wed, 22 Sep 2021 22:13:13 +0000 (22:13 +0000)]
Auto merge of #7693 - F3real:vec2, r=Manishearth

Expand box_vec lint to box_collection

fixed #7451

changelog: Expand `box_vec` into [`box_collection`], and have it error on all sorts of boxed collections

2 years agoAdd missing reference to box_vec
F3real [Wed, 22 Sep 2021 17:59:32 +0000 (19:59 +0200)]
Add missing reference to box_vec

2 years agoAuto merge of #7704 - camsteffen:pedantic-occasional, r=Manishearth
bors [Wed, 22 Sep 2021 16:55:34 +0000 (16:55 +0000)]
Auto merge of #7704 - camsteffen:pedantic-occasional, r=Manishearth

Tweak pedantic description for occasional FPs

changelog: none

Okay this is getting a bit picky (you might even say pedantic). I think we need to be careful not use the pedantic category as cover-all for lints with any amount of false positives. Lints with a high degree of FPs should be nursery or restriction IMO. If the pedantic category were to yield, say hypothetically, over 50% FPs, it would just be too annoying to use at all (to be sure, "too picky for me" is not a FP).

CC `@rust-lang/clippy`

2 years agoTweak pedantic description for occasional FPs
Cameron Steffen [Wed, 22 Sep 2021 15:34:34 +0000 (10:34 -0500)]
Tweak pedantic description for occasional FPs

2 years agoAuto merge of #7679 - lengyijun:issue4546, r=xFrednet
bors [Wed, 22 Sep 2021 09:00:30 +0000 (09:00 +0000)]
Auto merge of #7679 - lengyijun:issue4546, r=xFrednet

add #4546 test

changelog: none
fixed #4546

I notice #4546 was fixed some time, I just add the tests.

2 years agoadd #4546 test
lengyijun [Fri, 17 Sep 2021 03:48:21 +0000 (11:48 +0800)]
add #4546 test

2 years agoAuto merge of #7685 - camsteffen:let-else-needless-ret, r=giraffate
bors [Wed, 22 Sep 2021 00:23:23 +0000 (00:23 +0000)]
Auto merge of #7685 - camsteffen:let-else-needless-ret, r=giraffate

Fix needless_return with let-else

changelog: Fix needless_return FP with `let...else`

Fixes #7637

2 years agoAuto merge of #89158 - the8472:rollup-3e4ijth, r=the8472
bors [Tue, 21 Sep 2021 22:07:32 +0000 (22:07 +0000)]
Auto merge of #89158 - the8472:rollup-3e4ijth, r=the8472

Rollup of 12 pull requests

Successful merges:

 - #88795 (Print a note if a character literal contains a variation selector)
 - #89015 (core::ascii::escape_default: reduce struct size)
 - #89078 (Cleanup: Remove needless reference in ParentHirIterator)
 - #89086 (Stabilize `Iterator::map_while`)
 - #89096 ([bootstrap] Improve the error message when `ninja` is not found to link to installation instructions)
 - #89113 (dont `.ensure()` the `thir_abstract_const` query call in `mir_build`)
 - #89114 (Fixes a technicality regarding the size of C's `char` type)
 - #89115 (:arrow_up: rust-analyzer)
 - #89126 (Fix ICE when `indirect_structural_match` is allowed)
 - #89141 (Impl `Error` for `FromSecsError` without foreign type)
 - #89142 (Fix match for placeholder region)
 - #89147 (add case for checking const refs in check_const_value_eq)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agoRollup merge of #89078 - camsteffen:map-ref, r=cjgillot
the8472 [Tue, 21 Sep 2021 20:54:00 +0000 (22:54 +0200)]
Rollup merge of #89078 - camsteffen:map-ref, r=cjgillot

Cleanup: Remove needless reference in ParentHirIterator

It forces an intermediate binding of `Map` which is a Copy type.

2 years agoAuto merge of #89103 - Mark-Simulacrum:migrate-2021, r=estebank
bors [Tue, 21 Sep 2021 19:25:49 +0000 (19:25 +0000)]
Auto merge of #89103 - Mark-Simulacrum:migrate-2021, r=estebank

Migrate in-tree crates to 2021

This replaces #89075 (cherry picking some of the commits from there), and closes #88637 and fixes #89074.

It excludes a migration of the library crates for now (see tidy diff) because we have some pending bugs around macro spans to fix there.

I instrumented bootstrap during the migration to make sure all crates moved from 2018 to 2021 had the compatibility warnings applied first.

Originally, the intent was to support cargo fix --edition within bootstrap, but this proved fairly difficult to pull off. We'd need to architect the check functionality to support running cargo check and cargo fix within the same x.py invocation, and only resetting sysroots on check. Further, it was found that cargo fix doesn't behave too well with "not quite workspaces", such as Clippy which has several crates. Bootstrap runs with --manifest-path ... for all the tools, and this makes cargo fix only attempt migration for that crate. We can't use e.g. --workspace due to needing to maintain sysroots for different phases of compilation appropriately.

It is recommended to skip the mass migration of Cargo.toml's to 2021 for review purposes; you can also use `git diff d6cd2c6c877110748296760aefddc21a0ea1d316 -I'^edition = .20...$'` to ignore the edition = 2018/21 lines in the diff.

2 years agoDemote float_cmp to pedantic
Jubilee Young [Sun, 19 Sep 2021 23:10:29 +0000 (16:10 -0700)]
Demote float_cmp to pedantic

2 years agoAuto merge of #7694 - Jarcho:lintcheck_retry, r=matthiaskrgr
bors [Tue, 21 Sep 2021 16:59:48 +0000 (16:59 +0000)]
Auto merge of #7694 - Jarcho:lintcheck_retry, r=matthiaskrgr

Retry on some download errors in lintcheck

I'm currently on spotty wifi right now. It is shocking the number of things that break when you lose connection for a few seconds. Some 500 errors should probably also be retried, but this fixes my issue.

changelog: None

2 years agoUse ZST for fmt unsafety
Cameron Steffen [Tue, 21 Sep 2021 05:56:45 +0000 (00:56 -0500)]
Use ZST for fmt unsafety

This allows the format_args! macro to keep the pre-expansion code out of
the unsafe block without doing gymnastics with nested `match`
expressions. This reduces codegen.

2 years agoRemove Drop-caused migration-added captures
Mark Rousskov [Sun, 19 Sep 2021 17:46:05 +0000 (13:46 -0400)]
Remove Drop-caused migration-added captures

All of these were added due to insignificant Drop types being present.

2 years agoRegister lint rename
F3real [Mon, 20 Sep 2021 21:07:17 +0000 (23:07 +0200)]
Register lint rename

2 years agoRetry on some download errors in lintcheck
Jason Newcomb [Mon, 20 Sep 2021 16:50:59 +0000 (12:50 -0400)]
Retry on some download errors in lintcheck

2 years agoEnable 2021 compatibility lints for all in-tree code
Mark Rousskov [Sat, 18 Sep 2021 21:37:24 +0000 (17:37 -0400)]
Enable 2021 compatibility lints for all in-tree code

This just applies the suggested fixes from the compatibility warnings,
leaving any that are in practice spurious in. This is primarily intended to
provide a starting point to identify possible fixes to the migrations (e.g., by
avoiding spurious warnings).

A secondary commit cleans these up where they are false positives (as is true in
many of the cases).

2 years agoExpand BOX_VEC to BOX_COLLECTION
F3real [Fri, 17 Sep 2021 22:56:14 +0000 (00:56 +0200)]
Expand BOX_VEC to BOX_COLLECTION

2 years agoDo not store visibility in *ItemRef.
Camille GILLOT [Thu, 15 Jul 2021 20:19:39 +0000 (22:19 +0200)]
Do not store visibility in *ItemRef.