Skip to content

False positive for redundant_closure involving lifetimes #5594

Closed
@Kixunil

Description

@Kixunil

I hit a false positive when contributing to rusqlite. The code in the PR can not be written without that closure as it doesn't seem to unify for some reason. Not sure if it's a bug in the compiler or some kind of deficiency in my code (please look at that TryFrom impl, if you think you could help). Would love to file issue against rustc, if relevant, but I don't even know what keywords to use for searching for existing issues. :(

Without the closure I got:

   --> src/row.rs:382:76
    |
382 |         let val = conn.query_row("SELECT a FROM test", std::iter::empty(), <(u32,)>::try_from)
    |                                                                            ^^^^^^^^^^^^^^^^^^
    |                                                                            |
    |                                                                            expected signature of `for<'r, 's> fn(&'r row::Row<'s>) -> _`
    |                                                                            found signature of `fn(_) -> _`

error[E0271]: type mismatch resolving `for<'r, 's> <fn(_) -> std::result::Result<(u32,), <(u32,) as std::convert::TryFrom<_>>::Error> {<(u32,) as std::convert::TryFrom<_>>::try_from} as std::ops::FnOnce<(&'r row::Row<'s>,)>>::Output == std::result::Result<_, error::Error>`

Edit: sorry for forgetting to paste version. I don't know the version from rusqlite CI, but same issue is present in clippy 0.0.212 (69f99e7 2019-12-14). I also tried to impl TryFrom using a single lifetime - same problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thingE-hardCall for participation: This a hard problem and requires more experience or effort to work onI-false-positiveIssue: The lint was triggered on code it shouldn't have

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions