Skip to content

Function anyhow::Ok breaks Ok pattern matching when wildcard importing #201

@N3xed

Description

@N3xed

When wildcard importing anyhow (use anyhow::*), the recently added function anyhow::Ok breaks pattern-matching because it shadows Result::Ok and thus causes build failures:

error[E0532]: expected tuple struct or tuple variant, found function `Ok`
   --> src\utils.rs:199:13
    |
199 |             Ok(result) => {
    |             ^^ not a tuple struct or tuple variant
    |
   ::: src\python.rs:12:23
    |
12  |     let version_str = cmd_output!(PYTHON, "--version")
    |                       -------------------------------- in this macro invocation
    |

In my view, this is a breaking change.

It's quite convenient to import all of anyhow at once, so I'd suggest moving this function into a module. Or it would need a new major version, but this may be overkill for such a small change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions