Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a new lint unneeded_where_clauses, suggests removing empty where clauses #125277

Closed
wants to merge 1 commit into from

Conversation

mu001999
Copy link
Contributor

Fixes #125242

@rustbot
Copy link
Collaborator

rustbot commented May 19, 2024

r? @wesleywiser

rustbot has assigned @wesleywiser.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 19, 2024
@cjgillot
Copy link
Contributor

Would this be better placed in rustfmt?

@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-llvm-17 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
#16 exporting to docker image format
#16 sending tarball 29.5s done
#16 DONE 34.4s
##[endgroup]
Setting extra environment values for docker:  --env ENABLE_GCC_CODEGEN=1 --env GCC_EXEC_PREFIX=/usr/lib/gcc/
[CI_JOB_NAME=x86_64-gnu-llvm-17]
---
sccache: Starting the server...
##[group]Configure the build
configure: processing command line
configure: 
configure: build.configure-args := ['--build=x86_64-unknown-linux-gnu', '--llvm-root=/usr/lib/llvm-17', '--enable-llvm-link-shared', '--set', 'rust.thin-lto-import-instr-limit=10', '--set', 'change-id=99999999', '--enable-verbose-configure', '--enable-sccache', '--disable-manage-submodules', '--enable-locked-deps', '--enable-cargo-native-static', '--set', 'rust.codegen-units-std=1', '--set', 'dist.compression-profile=balanced', '--dist-compression-formats=xz', '--disable-dist-src', '--release-channel=nightly', '--enable-debug-assertions', '--enable-overflow-checks', '--enable-llvm-assertions', '--set', 'rust.verify-llvm-ir', '--set', 'rust.codegen-backends=llvm,cranelift,gcc', '--set', 'llvm.static-libstdcpp', '--enable-new-symbol-mangling']
configure: target.x86_64-unknown-linux-gnu.llvm-config := /usr/lib/llvm-17/bin/llvm-config
configure: llvm.link-shared     := True
configure: rust.thin-lto-import-instr-limit := 10
configure: change-id            := 99999999
---
normalized stderr:
warning: this empty where clause is unneeded
##[warning]  --> $DIR/issue-93341.rs:11:23
   |
LL | pub trait HasLifetime where {
   |
   = note: `#[warn(unneeded_where_clauses)]` on by default

warning: 1 warning emitted
---
To only update this specific test, also pass `--test-args generic-associated-types/issue-93341.rs`

error: 1 errors occurred comparing output.
status: exit status: 0
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/generic-associated-types/issue-93341.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--check-cfg" "cfg(FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/generic-associated-types/issue-93341" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/generic-associated-types/issue-93341/auxiliary"
--- stderr -------------------------------
warning: this empty where clause is unneeded
##[warning]  --> /checkout/tests/ui/generic-associated-types/issue-93341.rs:11:23
   |
   |
LL | pub trait HasLifetime where {
   |
   = note: `#[warn(unneeded_where_clauses)]` on by default

warning: 1 warning emitted
---

+ warning: this empty where clause is unneeded
+   --> $DIR/issue-55731.rs:17:86
+    |
+ LL | impl<I: for<'a> DistributedIteratorMulti<&'a ()>> DistributedIterator for Connect<I> where {}
+    |
+    = note: `#[warn(unneeded_where_clauses)]` on by default
+ 
+ 
1 error: implementation of `DistributedIteratorMulti` is not general enough
3    |


10    = note: `DistributedIteratorMulti<&'0 ()>` would have to be implemented for the type `Cloned<&()>`, for any lifetime `'0`...
11    = note: ...but `DistributedIteratorMulti<&'1 ()>` is actually implemented for the type `Cloned<&'1 ()>`, for some specific lifetime `'1`
- error: aborting due to 1 previous error
+ error: aborting due to 1 previous error; 1 warning emitted
14 
15 
---
To only update this specific test, also pass `--test-args issues/issue-55731.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/issues/issue-55731.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--check-cfg" "cfg(FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-55731" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-55731/auxiliary"
--- stderr -------------------------------
warning: this empty where clause is unneeded
##[warning]  --> /checkout/tests/ui/issues/issue-55731.rs:17:86
   |
   |
LL | impl<I: for<'a> DistributedIteratorMulti<&'a ()>> DistributedIterator for Connect<I> where {}
   |
   = note: `#[warn(unneeded_where_clauses)]` on by default


error: implementation of `DistributedIteratorMulti` is not general enough
   |
   |
LL | /     multi(Map { //~ ERROR implementation of `DistributedIteratorMulti` is not general enough
LL | |         i: Cloned(PhantomData),
LL | |         f: X,
LL | |     });
   | |______^ implementation of `DistributedIteratorMulti` is not general enough
   |
   = note: `DistributedIteratorMulti<&'0 ()>` would have to be implemented for the type `Cloned<&()>`, for any lifetime `'0`...
   = note: ...but `DistributedIteratorMulti<&'1 ()>` is actually implemented for the type `Cloned<&'1 ()>`, for some specific lifetime `'1`
error: aborting due to 1 previous error; 1 warning emitted
------------------------------------------


---
To only update this specific test, also pass `--test-args lazy-type-alias/leading-where-clause.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/lazy-type-alias/leading-where-clause.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--check-cfg" "cfg(FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/lazy-type-alias/leading-where-clause" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/lazy-type-alias/leading-where-clause/auxiliary"
--- stderr -------------------------------
error: where clauses are not allowed before the type for type aliases
##[error]  --> /checkout/tests/ui/lazy-type-alias/leading-where-clause.rs:10:1
   |
   |
LL | / where //~ ERROR where clauses are not allowed before the type for type aliases
LL | |     String: From<T>,
   |
   = note: see issue #89122 <https://github.com/rust-lang/rust/issues/89122> for more information
help: move it to the end of the type declaration
   |
   |
LL + 
LL ~ = T where String: From<T>;

error: where clauses are not allowed before the type for type aliases
##[error]  --> /checkout/tests/ui/lazy-type-alias/leading-where-clause.rs:15:1
   |
   |
LL | / where //~ ERROR where clauses are not allowed before the type for type aliases
LL | |     String: From<T>,
   |
   = note: see issue #89122 <https://github.com/rust-lang/rust/issues/89122> for more information
help: move it to the end of the type declaration
   |
   |
LL + 
LL | = (T, U)
LL | where
LL ~     U: Copy, String: From<T>;

error: where clauses are not allowed before the type for type aliases
##[error]  --> /checkout/tests/ui/lazy-type-alias/leading-where-clause.rs:21:24
   |
   |
LL | pub type EmptyLeading0 where = ();
   |                        ^^^^^
   |
   = note: see issue #89122 <https://github.com/rust-lang/rust/issues/89122> for more information
help: move it to the end of the type declaration
   |
LL - pub type EmptyLeading0 where = ();
LL + pub type EmptyLeading0  = () where;

error: where clauses are not allowed before the type for type aliases
##[error]  --> /checkout/tests/ui/lazy-type-alias/leading-where-clause.rs:24:27
   |
   |
LL | pub type EmptyLeading1<T> where = T where T: Copy;
   |                           ^^^^^ help: remove this `where`
   = note: see issue #89122 <https://github.com/rust-lang/rust/issues/89122> for more information

warning: this empty where clause is unneeded
   |
---

+ warning: this empty where clause is unneeded
+   --> $DIR/use_of_moved_value_copy_suggestions.rs:43:51
+    |
+ LL | fn duplicate_custom_1<T>(t: S<T>) -> (S<T>, S<T>) where {
+    |
+    = note: `#[warn(unneeded_where_clauses)]` on by default
+ 
1 error[E0382]: use of moved value: `t`
1 error[E0382]: use of moved value: `t`
2   --> $DIR/use_of_moved_value_copy_suggestions.rs:7:9
3    |

198 LL |     T:, T: Copy
200 
- error: aborting due to 11 previous errors
+ error: aborting due to 11 previous errors; 1 warning emitted
202 
---
To only update this specific test, also pass `--test-args moves/use_of_moved_value_copy_suggestions.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/moves/use_of_moved_value_copy_suggestions.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--check-cfg" "cfg(FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/moves/use_of_moved_value_copy_suggestions" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/moves/use_of_moved_value_copy_suggestions/auxiliary"
--- stderr -------------------------------
warning: this empty where clause is unneeded
##[warning]  --> /checkout/tests/ui/moves/use_of_moved_value_copy_suggestions.rs:43:51
   |
   |
LL | fn duplicate_custom_1<T>(t: S<T>) -> (S<T>, S<T>) where {
   |
   = note: `#[warn(unneeded_where_clauses)]` on by default

error[E0382]: use of moved value: `t`
error[E0382]: use of moved value: `t`
##[error]  --> /checkout/tests/ui/moves/use_of_moved_value_copy_suggestions.rs:7:9
   |
LL | fn duplicate_t<T>(t: T) -> (T, T) {
   |                   - move occurs because `t` has type `T`, which does not implement the `Copy` trait
...
LL |     (t, t) //~ use of moved value: `t`
   |      -  ^ value used here after move
   |      value moved here
   |
   |
help: if `T` implemented `Clone`, you could clone the value
   |
   |
LL | fn duplicate_t<T>(t: T) -> (T, T) {
   |                ^ consider constraining this type parameter with `Clone`
...
LL |     (t, t) //~ use of moved value: `t`
   |      - you could clone this value
help: consider restricting type parameter `T`
   |
LL | fn duplicate_t<T: Copy>(t: T) -> (T, T) {

error[E0382]: use of moved value: `t`
##[error]  --> /checkout/tests/ui/moves/use_of_moved_value_copy_suggestions.rs:12:9
   |
   |
LL | fn duplicate_opt<T>(t: Option<T>) -> (Option<T>, Option<T>) {
   |                     - move occurs because `t` has type `Option<T>`, which does not implement the `Copy` trait
LL |     //~^ HELP consider restricting type parameter `T`
LL |     (t, t) //~ use of moved value: `t`
   |      -  ^ value used here after move
   |      value moved here
   |
help: consider restricting type parameter `T`
   |
   |
LL | fn duplicate_opt<T: Copy>(t: Option<T>) -> (Option<T>, Option<T>) {

error[E0382]: use of moved value: `t`
##[error]  --> /checkout/tests/ui/moves/use_of_moved_value_copy_suggestions.rs:17:9
   |
   |
LL | fn duplicate_tup1<T>(t: (T,)) -> ((T,), (T,)) {
   |                      - move occurs because `t` has type `(T,)`, which does not implement the `Copy` trait
LL |     //~^ HELP consider restricting type parameter `T`
LL |     (t, t) //~ use of moved value: `t`
   |      -  ^ value used here after move
   |      value moved here
   |
help: consider restricting type parameter `T`
   |
   |
LL | fn duplicate_tup1<T: Copy>(t: (T,)) -> ((T,), (T,)) {

error[E0382]: use of moved value: `t`
##[error]  --> /checkout/tests/ui/moves/use_of_moved_value_copy_suggestions.rs:22:9
   |
   |
LL | fn duplicate_tup2<A, B>(t: (A, B)) -> ((A, B), (A, B)) {
   |                         - move occurs because `t` has type `(A, B)`, which does not implement the `Copy` trait
LL |     //~^ HELP consider restricting type parameters
LL |     (t, t) //~ use of moved value: `t`
   |      -  ^ value used here after move
   |      value moved here
   |
help: consider restricting type parameters
   |
   |
LL | fn duplicate_tup2<A: Copy, B: Copy>(t: (A, B)) -> ((A, B), (A, B)) {
   |                    ++++++   ++++++
error[E0382]: use of moved value: `t`
##[error]  --> /checkout/tests/ui/moves/use_of_moved_value_copy_suggestions.rs:27:9
   |
   |
LL | fn duplicate_custom<T>(t: S<T>) -> (S<T>, S<T>) {
   |                        - move occurs because `t` has type `S<T>`, which does not implement the `Copy` trait
LL |     //~^ HELP consider restricting type parameter `T`
LL |     (t, t) //~ use of moved value: `t`
   |      -  ^ value used here after move
   |      value moved here
   |
help: consider restricting type parameter `T`
   |
   |
LL | fn duplicate_custom<T: Copy + Trait>(t: S<T>) -> (S<T>, S<T>) {

error[E0382]: use of moved value: `t`
##[error]  --> /checkout/tests/ui/moves/use_of_moved_value_copy_suggestions.rs:45:9
   |
   |
LL | fn duplicate_custom_1<T>(t: S<T>) -> (S<T>, S<T>) where {
   |                          - move occurs because `t` has type `S<T>`, which does not implement the `Copy` trait
LL |     //~^ HELP consider restricting type parameter `T`
LL |     (t, t) //~ use of moved value: `t`
   |      -  ^ value used here after move
   |      value moved here
   |
help: consider restricting type parameter `T`
   |
   |
LL | fn duplicate_custom_1<T: Copy + Trait>(t: S<T>) -> (S<T>, S<T>) where {

error[E0382]: use of moved value: `t`
##[error]  --> /checkout/tests/ui/moves/use_of_moved_value_copy_suggestions.rs:53:9
   |
   |
LL | fn duplicate_custom_2<T>(t: S<T>) -> (S<T>, S<T>)
   |                          - move occurs because `t` has type `S<T>`, which does not implement the `Copy` trait
...
LL |     (t, t) //~ use of moved value: `t`
   |      -  ^ value used here after move
   |      value moved here
   |
help: consider further restricting this bound
   |
   |
LL |     T: A + Copy + Trait,

error[E0382]: use of moved value: `t`
##[error]  --> /checkout/tests/ui/moves/use_of_moved_value_copy_suggestions.rs:62:9
   |
   |
LL | fn duplicate_custom_3<T>(t: S<T>) -> (S<T>, S<T>)
   |                          - move occurs because `t` has type `S<T>`, which does not implement the `Copy` trait
...
LL |     (t, t) //~ use of moved value: `t`
   |      -  ^ value used here after move
   |      value moved here
   |
help: consider further restricting this bound
   |
   |
LL |     T: A + Copy + Trait,

error[E0382]: use of moved value: `t`
##[error]  --> /checkout/tests/ui/moves/use_of_moved_value_copy_suggestions.rs:70:9
   |
   |
LL | fn duplicate_custom_4<T: A>(t: S<T>) -> (S<T>, S<T>)
   |                             - move occurs because `t` has type `S<T>`, which does not implement the `Copy` trait
...
LL |     (t, t) //~ use of moved value: `t`
   |      -  ^ value used here after move
   |      value moved here
   |
help: consider further restricting this bound
   |
   |
LL | fn duplicate_custom_4<T: A + Copy + Trait>(t: S<T>) -> (S<T>, S<T>)

error[E0382]: use of moved value: `t`
##[error]  --> /checkout/tests/ui/moves/use_of_moved_value_copy_suggestions.rs:77:9
   |
   |
LL | fn existing_colon<T:>(t: T) {
   |                       - move occurs because `t` has type `T`, which does not implement the `Copy` trait
...
LL |     [t, t]; //~ use of moved value: `t`
   |      -  ^ value used here after move
   |      value moved here
   |
   |
help: if `T` implemented `Clone`, you could clone the value
   |
   |
LL | fn existing_colon<T:>(t: T) {
   |                   ^ consider constraining this type parameter with `Clone`
...
LL |     [t, t]; //~ use of moved value: `t`
   |      - you could clone this value
help: consider restricting type parameter `T`
   |
LL | fn existing_colon<T: Copy>(t: T) {

error[E0382]: use of moved value: `t`
##[error]  --> /checkout/tests/ui/moves/use_of_moved_value_copy_suggestions.rs:85:9
   |
   |
LL | fn existing_colon_in_where<T>(t: T) //~ HELP if `T` implemented `Clone`, you could clone the value
   |                               - move occurs because `t` has type `T`, which does not implement the `Copy` trait
...
LL |     [t, t]; //~ use of moved value: `t`
   |      -  ^ value used here after move
   |      value moved here
   |
   |
help: if `T` implemented `Clone`, you could clone the value
   |
   |
LL | fn existing_colon_in_where<T>(t: T) //~ HELP if `T` implemented `Clone`, you could clone the value
   |                            ^ consider constraining this type parameter with `Clone`
...
LL |     [t, t]; //~ use of moved value: `t`
   |      - you could clone this value
help: consider further restricting type parameter `T`
   |
LL |     T:, T: Copy

error: aborting due to 11 previous errors; 1 warning emitted

For more information about this error, try `rustc --explain E0382`.
---
To only update this specific test, also pass `--test-args parser/foreign-ty-semantic-fail.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/parser/foreign-ty-semantic-fail.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--check-cfg" "cfg(FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/parser/foreign-ty-semantic-fail" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/parser/foreign-ty-semantic-fail/auxiliary"
--- stderr -------------------------------
--- stderr -------------------------------
error: bounds on `type`s in `extern` blocks have no effect
   |
   |
LL |     type A: Ord;


error: `type`s inside `extern` blocks cannot have generic parameters
   |
LL | extern "C" {
LL | extern "C" {
   | ---------- `extern` block begins here
...
LL |     type B<'a> where 'a: 'static;
   |
   = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html


error: `type`s inside `extern` blocks cannot have `where` clauses
   |
LL | extern "C" {
LL | extern "C" {
   | ---------- `extern` block begins here
...
LL |     type B<'a> where 'a: 'static;
   |                ^^^^^^^^^^^^^^^^^ help: remove the `where` clause
   = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html


error: `type`s inside `extern` blocks cannot have generic parameters
   |
LL | extern "C" {
LL | extern "C" {
   | ---------- `extern` block begins here
...
LL |     type C<T: Ord> where T: 'static;
   |
   = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html


error: `type`s inside `extern` blocks cannot have `where` clauses
   |
LL | extern "C" {
LL | extern "C" {
   | ---------- `extern` block begins here
...
LL |     type C<T: Ord> where T: 'static;
   |                    ^^^^^^^^^^^^^^^^ help: remove the `where` clause
   = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html

error: incorrect `type` inside `extern` block
##[error]  --> /checkout/tests/ui/parser/foreign-ty-semantic-fail.rs:14:10
##[error]  --> /checkout/tests/ui/parser/foreign-ty-semantic-fail.rs:14:10
   |
LL | extern "C" {
   | ---------- `extern` blocks define existing foreign types and types inside of them cannot have a body
LL |     type D = u8;
   |          ^   -- the invalid body
   |          |
   |          cannot have a body
   |          cannot have a body
   |
   = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html

error: `type`s inside `extern` blocks cannot have `where` clauses
   |
LL | extern "C" {
LL | extern "C" {
   | ---------- `extern` block begins here
LL |     type E: where;
LL |     type E: where;
   |             ^^^^^ help: remove the `where` clause
   = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html

warning: this empty where clause is unneeded
   |
---

+ warning: this empty where clause is unneeded
+   --> $DIR/partialeq_help.rs:5:36
+    |
+ LL | fn foo2<T: PartialEq>(a: &T, b: T) where {
+    |
+    = note: `#[warn(unneeded_where_clauses)]` on by default
+ 
+ 
1 error[E0277]: can't compare `&T` with `T`
3    |


30 LL | fn foo2<T: PartialEq>(a: &T, b: T) where &T: PartialEq<T> {
32 
- error: aborting due to 2 previous errors
+ error: aborting due to 2 previous errors; 1 warning emitted
34 
---
To only update this specific test, also pass `--test-args partialeq_help.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/partialeq_help.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--check-cfg" "cfg(FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/partialeq_help" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/partialeq_help/auxiliary"
--- stderr -------------------------------
warning: this empty where clause is unneeded
##[warning]  --> /checkout/tests/ui/partialeq_help.rs:5:36
   |
   |
LL | fn foo2<T: PartialEq>(a: &T, b: T) where {
   |
   = note: `#[warn(unneeded_where_clauses)]` on by default


error[E0277]: can't compare `&T` with `T`
   |
   |
LL |     a == b; //~ ERROR E0277
   |       ^^ no implementation for `&T == T`
   |
   = help: the trait `PartialEq<T>` is not implemented for `&T`
   |
   |
LL |     *a == b; //~ ERROR E0277
   |     +
help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement
   |
LL | fn foo<T: PartialEq>(a: &T, b: T) where &T: PartialEq<T> {


error[E0277]: can't compare `&T` with `T`
   |
   |
LL |     a == b; //~ ERROR E0277
   |       ^^ no implementation for `&T == T`
   |
   = help: the trait `PartialEq<T>` is not implemented for `&T`
   |
   |
LL |     *a == b; //~ ERROR E0277
   |     +
help: consider extending the `where` clause, but there might be an alternative better way to express this requirement
   |
LL | fn foo2<T: PartialEq>(a: &T, b: T) where &T: PartialEq<T> {

error: aborting due to 2 previous errors; 1 warning emitted

For more information about this error, try `rustc --explain E0277`.
---
+ 
+ warning: this empty where clause is unneeded
+   --> $DIR/empty-where-clause.rs:12:34
+    |
+ LL | struct TupleStruct(MissingType2) where;
+ 
+ warning: this empty where clause is unneeded
+   --> $DIR/empty-where-clause.rs:14:13
+    |
+    |
+ LL | enum MyEnum where {
+ 
+ error: aborting due to 3 previous errors; 3 warnings emitted
20 
21 For more information about this error, try `rustc --explain E0412`.
---
To only update this specific test, also pass `--test-args proc-macro/empty-where-clause.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/proc-macro/empty-where-clause.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--check-cfg" "cfg(FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/proc-macro/empty-where-clause" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/proc-macro/empty-where-clause/auxiliary"
--- stderr -------------------------------
error[E0412]: cannot find type `MissingType1` in this scope
##[error]  --> /checkout/tests/ui/proc-macro/empty-where-clause.rs:8:12
   |
   |
LL |     field: MissingType1 //~ ERROR cannot find

error[E0412]: cannot find type `MissingType2` in this scope
##[error]  --> /checkout/tests/ui/proc-macro/empty-where-clause.rs:12:20
   |
   |
LL | struct TupleStruct(MissingType2) where; //~ ERROR cannot find

error[E0412]: cannot find type `MissingType3` in this scope
##[error]  --> /checkout/tests/ui/proc-macro/empty-where-clause.rs:15:13
   |
   |
LL |     Variant(MissingType3) //~ ERROR cannot find

warning: this empty where clause is unneeded
##[warning]  --> /checkout/tests/ui/proc-macro/empty-where-clause.rs:7:20
   |
---

warning: this empty where clause is unneeded
##[warning]  --> /checkout/tests/ui/proc-macro/empty-where-clause.rs:12:34
   |
LL | struct TupleStruct(MissingType2) where; //~ ERROR cannot find

warning: this empty where clause is unneeded
##[warning]  --> /checkout/tests/ui/proc-macro/empty-where-clause.rs:14:13
   |
   |
LL | enum MyEnum where {

error: aborting due to 3 previous errors; 3 warnings emitted

For more information about this error, try `rustc --explain E0412`.
---
1 error[E0277]: `<impl IntoIterator as IntoIterator>::Item` doesn't implement `std::fmt::Display`
2   --> $DIR/issue-97760.rs:4:19
3    |

13 LL ~ where <I as IntoIterator>::Item: std::fmt::Display {
15 
- error: aborting due to 1 previous error
+ error: aborting due to 1 previous error; 1 warning emitted
17 
---
To only update this specific test, also pass `--test-args suggestions/issue-97760.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/suggestions/issue-97760.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--check-cfg" "cfg(FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/suggestions/issue-97760" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/suggestions/issue-97760/auxiliary"
--- stderr -------------------------------
warning: this empty where clause is unneeded
##[warning]  --> /checkout/tests/ui/suggestions/issue-97760.rs:2:1
   |
---

error[E0277]: `<impl IntoIterator as IntoIterator>::Item` doesn't implement `std::fmt::Display`
##[error]  --> /checkout/tests/ui/suggestions/issue-97760.rs:4:19
   |
LL |         println!("{x}");
   |                   ^^^ `<impl IntoIterator as IntoIterator>::Item` cannot be formatted with the default formatter
   = help: the trait `std::fmt::Display` is not implemented for `<impl IntoIterator as IntoIterator>::Item`
   = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
   = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
help: introduce a type parameter with a trait bound instead of using `impl Trait`
help: introduce a type parameter with a trait bound instead of using `impl Trait`
   |
LL ~ pub fn print_values<I: IntoIterator>(values: &I)
LL ~ where <I as IntoIterator>::Item: std::fmt::Display {

error: aborting due to 1 previous error; 1 warning emitted

For more information about this error, try `rustc --explain E0277`.
---

+ warning: this empty where clause is unneeded
+   --> $DIR/impl-missing-where-clause-lifetimes-from-trait.rs:6:38
+    |
+ LL |     fn foo<'a, K>(self, _: (), _: K) where {
+    |
+    = note: `#[warn(unneeded_where_clauses)]` on by default
+ 
+ 
1 error[E0195]: lifetime parameters or bounds on method `foo` do not match the trait declaration
3    |


31 LL |     fn foo<'a: 'a>(&'a self) {}
32    |           ^^^^^^^^ lifetimes do not match method in trait
- error: aborting due to 3 previous errors
+ error: aborting due to 3 previous errors; 1 warning emitted
35 
36 For more information about this error, try `rustc --explain E0195`.
---
To only update this specific test, also pass `--test-args trait-bounds/impl-missing-where-clause-lifetimes-from-trait.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/trait-bounds/impl-missing-where-clause-lifetimes-from-trait.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--check-cfg" "cfg(FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/trait-bounds/impl-missing-where-clause-lifetimes-from-trait" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/trait-bounds/impl-missing-where-clause-lifetimes-from-trait/auxiliary"
--- stderr -------------------------------
warning: this empty where clause is unneeded
##[warning]  --> /checkout/tests/ui/trait-bounds/impl-missing-where-clause-lifetimes-from-trait.rs:6:38
   |
   |
LL |     fn foo<'a, K>(self, _: (), _: K) where { //~ ERROR E0195
   |
   = note: `#[warn(unneeded_where_clauses)]` on by default


error[E0195]: lifetime parameters or bounds on method `foo` do not match the trait declaration
   |
   |
LL |     fn foo<'a, K>(self, _: T, _: K) where T: 'a, K: 'a;
   |           |                                  |
   |           |                                  this bound might be missing in the impl
   |           lifetimes in impl do not match this method in trait
...
...
LL |     fn foo<'a, K>(self, _: (), _: K) where { //~ ERROR E0195
   |           ^^^^^^^ lifetimes do not match method in trait

error[E0195]: lifetime parameters or bounds on method `foo` do not match the trait declaration
   |
LL |     fn foo<'a>(&self, state: &'a State) -> &'a T
   |           ---- lifetimes in impl do not match this method in trait
LL |     where
LL |     where
LL |         T: 'a;
   |            -- this bound might be missing in the impl
...
LL |     fn foo<'a>(&self, state: &'a State) -> &'a T { //~ ERROR E0195
   |           ^^^^ lifetimes do not match method in trait

error[E0195]: lifetime parameters or bounds on method `foo` do not match the trait declaration
   |
LL |     fn foo<'a>(&'a self) {}
   |           ---- lifetimes in impl do not match this method in trait
...
...
LL |     fn foo<'a: 'a>(&'a self) {} //~ ERROR E0195
   |           ^^^^^^^^ lifetimes do not match method in trait
error: aborting due to 3 previous errors; 1 warning emitted

For more information about this error, try `rustc --explain E0195`.
------------------------------------------
------------------------------------------


---- [ui] tests/ui/where-clauses/where-clause-placement-assoc-type-in-impl.rs stdout ----
diff of stderr:

38 LL +     type Assoc3  = () where;
40 
+ warning: this empty where clause is unneeded
+    |
+    = note: `#[warn(unneeded_where_clauses)]` on by default
---
61 
- warning: 5 warnings emitted
+ warning: this empty where clause is unneeded
+    |
+    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+ warning: 7 warnings emitted
63 
64 

---
To only update this specific test, also pass `--test-args where-clauses/where-clause-placement-assoc-type-in-impl.rs`

error: 1 errors occurred comparing output.
status: exit status: 0
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/where-clauses/where-clause-placement-assoc-type-in-impl.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--check-cfg" "cfg(FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/where-clauses/where-clause-placement-assoc-type-in-impl" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/where-clauses/where-clause-placement-assoc-type-in-impl/auxiliary"
--- stderr -------------------------------
warning: where clause not allowed here
##[warning]  --> /checkout/tests/ui/where-clauses/where-clause-placement-assoc-type-in-impl.rs:17:16
   |
   |
LL |     type Assoc where u32: Copy = ();
   |
   = note: see issue #89122 <https://github.com/rust-lang/rust/issues/89122> for more information
   = note: `#[warn(deprecated_where_clause_location)]` on by default
help: move it to the end of the type declaration
help: move it to the end of the type declaration
   |
LL -     type Assoc where u32: Copy = ();
LL +     type Assoc  = () where u32: Copy;

warning: where clause not allowed here
##[warning]  --> /checkout/tests/ui/where-clauses/where-clause-placement-assoc-type-in-impl.rs:20:17
   |
   |
LL |     type Assoc2 where u32: Copy = () where i32: Copy;
   |
   = note: see issue #89122 <https://github.com/rust-lang/rust/issues/89122> for more information
help: move it to the end of the type declaration
   |
   |
LL -     type Assoc2 where u32: Copy = () where i32: Copy;
LL +     type Assoc2  = () where i32: Copy, u32: Copy;

warning: where clause not allowed here
##[warning]  --> /checkout/tests/ui/where-clauses/where-clause-placement-assoc-type-in-impl.rs:22:17
   |
   |
LL |     type Assoc3 where = ();
   |                 ^^^^^
   |
   = note: see issue #89122 <https://github.com/rust-lang/rust/issues/89122> for more information
help: move it to the end of the type declaration
   |
LL -     type Assoc3 where = ();
LL +     type Assoc3  = () where;

warning: this empty where clause is unneeded
   |
   = note: `#[warn(unneeded_where_clauses)]` on by default
   = note: `#[warn(unneeded_where_clauses)]` on by default

warning: where clause not allowed here
##[warning]  --> /checkout/tests/ui/where-clauses/where-clause-placement-assoc-type-in-impl.rs:30:17
   |
LL |     type Assoc2 where u32: Copy, i32: Copy = ();
   |
   = note: see issue #89122 <https://github.com/rust-lang/rust/issues/89122> for more information
help: move it to the end of the type declaration
   |
   |
LL -     type Assoc2 where u32: Copy, i32: Copy = ();
LL +     type Assoc2  = () where u32: Copy, i32: Copy;

warning: where clause not allowed here
##[warning]  --> /checkout/tests/ui/where-clauses/where-clause-placement-assoc-type-in-impl.rs:32:17
   |
   |
LL |     type Assoc3 where = () where;
   |                 ^^^^^ help: remove this `where`
   = note: see issue #89122 <https://github.com/rust-lang/rust/issues/89122> for more information

warning: this empty where clause is unneeded
   |
   |
   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: 7 warnings emitted
------------------------------------------


---
To only update this specific test, also pass `--test-args where-clauses/where-clause-placement-type-alias.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/where-clauses/where-clause-placement-type-alias.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--check-cfg" "cfg(FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/where-clauses/where-clause-placement-type-alias" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/where-clauses/where-clause-placement-type-alias/auxiliary"
--- stderr -------------------------------
error: where clauses are not allowed after the type for type aliases
##[error]  --> /checkout/tests/ui/where-clauses/where-clause-placement-type-alias.rs:6:15
   |
   |
LL | type Bar = () where u32: Copy;
   |
   = note: see issue #112792 <https://github.com/rust-lang/rust/issues/112792> for more information
   = help: add `#![feature(lazy_type_alias)]` to the crate attributes to enable


error: where clauses are not allowed after the type for type aliases
##[error]  --> /checkout/tests/ui/where-clauses/where-clause-placement-type-alias.rs:8:15
   |
LL | type Baz = () where;
   |
   = note: see issue #112792 <https://github.com/rust-lang/rust/issues/112792> for more information
   = help: add `#![feature(lazy_type_alias)]` to the crate attributes to enable

@mu001999
Copy link
Contributor Author

Would this be better placed in rustfmt?

In fact, I find rustfmt has covered this, it will remove the where if it's empty.

Copy link
Member

@compiler-errors compiler-errors left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't believe this should be made a lint in rustc, at least not first. Perhaps move this to clippy? Or yeah, as @cjgillot said, it may be better just as a formatting option.

@mu001999
Copy link
Contributor Author

I agree, and rustfmt has covered this. We can get fn foo() {} from fn foo() where {} after formatting. So I think I can just close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Empty where clauses don't have an unused warning
6 participants