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

clippy nightly warns on some function argument conversions #3561

Closed
alex opened this issue Nov 6, 2023 · 1 comment
Closed

clippy nightly warns on some function argument conversions #3561

alex opened this issue Nov 6, 2023 · 1 comment

Comments

@alex
Copy link
Contributor

alex commented Nov 6, 2023

Consider the following minimal method:

#[pyo3::prelude::pyclass]
struct Pool;

#[pyo3::pymethods]
impl Pool {
    fn acquire(slf: pyo3::Py<Self>) -> pyo3::Py<Self> {
        slf
    }
}

With the latest nightly, it produces the following clippy warning:

/t/t ❯❯❯ cargo +nightly clippy
warning: use of a fallible conversion when an infallible one could be used
 --> src/lib.rs:6:21
  |
6 |     fn acquire(slf: pyo3::Py<Self>) -> pyo3::Py<Self> {
  |                     ^^^^^^^^^^^^^^ help: use: `From::from`
  |
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_fallible_conversions
  = note: `#[warn(clippy::unnecessary_fallible_conversions)]` on by default

warning: `t` (lib) generated 1 warning
alex added a commit that referenced this issue Nov 7, 2023
alex added a commit that referenced this issue Nov 7, 2023
alex added a commit that referenced this issue Nov 27, 2023
alex added a commit that referenced this issue Nov 27, 2023
github-merge-queue bot pushed a commit that referenced this issue Nov 27, 2023
fixes #3561 -- silence new clippy warning
@davidhewitt
Copy link
Member

Fixed in #3564

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants