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

catch-22 with try block, clippy::unit_arg and clippy::unused_unit #3759

Closed
DenialAdams opened this issue Feb 12, 2019 · 1 comment
Closed
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 L-suggestion Lint: Improving, adding or fixing lint suggestions

Comments

@DenialAdams
Copy link

DenialAdams commented Feb 12, 2019

If I don't include a () at the end of a let res: Result<(), io::Error> = try block, I get a "passing a unit value to a function" clippy warning. If I do include a (), I get an "unneeded unit expression" clippy warning.

Sample code:

let res: Result<(), io::Error> = try {
   if true {
      some_statement();
   } else {
      some_other_statement();
   }
   //()
};
$ cargo clippy --version
clippy 0.0.212 (3bda548f 2019-02-03)
@phansch phansch added 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 labels Feb 12, 2019
@phansch phansch added the L-suggestion Lint: Improving, adding or fixing lint suggestions label Aug 24, 2019
@flip1995
Copy link
Member

This appears to be fixed: Playground

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 L-suggestion Lint: Improving, adding or fixing lint suggestions
Projects
None yet
Development

No branches or pull requests

3 participants