Skip to content

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

@DenialAdams

Description

@DenialAdams

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thingI-suggestion-causes-errorIssue: The suggestions provided by this Lint cause an ICE/error when appliedL-suggestionLint: Improving, adding or fixing lint suggestions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions