Skip to content

Extra semicolon after cargo clippy --fix #8336

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

Closed
tvallotton opened this issue Jan 23, 2022 · 2 comments · Fixed by #9497
Closed

Extra semicolon after cargo clippy --fix #8336

tvallotton opened this issue Jan 23, 2022 · 2 comments · Fixed by #9497
Assignees
Labels
C-bug Category: Clippy is not doing the correct thing I-suggestion-causes-error Issue: The suggestions provided by this Lint cause an ICE/error when applied

Comments

@tvallotton
Copy link

tvallotton commented Jan 23, 2022

Summary

you can access a reproducible example in this branch: clippy-fix-error. It seems that clippy forgot to remove a semicolon but I'm not entirely sure. I ran clippy --fix from the models/models directory.

Version

rustc 1.58.1 (db9d1b20b 2022-01-20)
binary: rustc
commit-hash: db9d1b20bba1968c1ec1fc49616d4742c1725b4b
commit-date: 2022-01-20
host: aarch64-apple-darwin
release: 1.58.1
LLVM version: 13.0.0

Error output

Backtrace

warning: `models` (lib) generated 46 warnings
warning: failed to automatically apply fixes suggested by rustc to crate `models`

after fixes were automatically applied the compiler reported errors within these files:

* models/src/orm/mod.rs
* models/src/private/scheduler/driver/migration.rs

This likely indicates a bug in either rustc or cargo itself,
and we would appreciate a bug report! You're likely to see 
a number of compiler warnings after this message which cargo
attempted to fix but failed. If you could open an issue at
https://github.com/rust-lang/rust/issues
quoting the full output of this command we'd be very appreciative!
Note that you may be able to make some more progress in the near-term
fixing code with the `--broken-code` flag

The following errors were reported:
error[E0308]: mismatched types
 --> models/src/private/scheduler/driver/migration.rs:86:28
  |
86  |     pub fn commit(self) -> Result<Option<Report>> {
  |            ------          ^^^^^^^^^^^^^^^^^^^^^^ expected enum `std::result::Result`, found `()`
  |            |
  |            implicitly returns `()` as its body has no tail or `return` expression
...
104 |         };
  |          - help: consider removing this semicolon
  |
  = note:   expected enum `std::result::Result<std::option::Option<private::scheduler::driver::report::Report>, error::Error>`
          found unit type `()`

warning: unused import: `ConnectOptions`
--> models/src/orm/mod.rs:12:5
 |
12 |     ConnectOptions,
 |     ^^^^^^^^^^^^^^
 |
 = note: `#[warn(unused_imports)]` on by default

error: aborting due to previous error; 1 warning emitted

For more information about this error, try `rustc --explain E0308`.
Original diagnostics will follow.

@tvallotton tvallotton added C-bug Category: Clippy is not doing the correct thing I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️ labels Jan 23, 2022
@J-ZhengLi
Copy link
Member

Here's a much simpler example in playground

I think the problem here is that you don't need to add a semicolon after if..else, and [needless_return] does not take it into account.

@giraffate giraffate added I-suggestion-causes-error Issue: The suggestions provided by this Lint cause an ICE/error when applied and removed I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️ labels Mar 23, 2022
@kraktus
Copy link
Contributor

kraktus commented Sep 18, 2022

@rustbot claim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing I-suggestion-causes-error Issue: The suggestions provided by this Lint cause an ICE/error when applied
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants