-
Notifications
You must be signed in to change notification settings - Fork 741
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
Attribute panic when applying clippy attributes to new #519
Comments
It seems the correct variant is to move "allow" lines right before the "impl" (wrapped by the "pymethods") block: #[allow(clippy::new_ret_no_self)]
#[allow(clippy::too_many_arguments)]
#[pymethods]
impl UUID {
#[new]
fn new(
obj: &PyRawObject,
hex: Option<&str>,
bytes: Option<Py<PyBytes>>,
bytes_le: Option<Py<PyBytes>>,
fields: Option<Py<PyTuple>>,
int: Option<u128>,
version: Option<u8>,
py: Python,
) -> PyResult<()> {} |
Which is fine I guess but it applies to the entire implementation instead of one function. |
What happens with #[pymethods]
impl UUID {
#[allow(clippy::too_many_arguments)]
#[allow(clippy::new_ret_no_self)]
#[new]
fn new(
...
) -> PyResult<()> {}
} ? |
Same panic. |
No, it applies just to a block. You can limit this attribute to a single function just moving it to a different "impl" block: #[allow(clippy::new_ret_no_self)]
#[allow(clippy::too_many_arguments)]
#[pymethods]
impl UUID {
#[new]
fn new(
obj: &PyRawObject,
hex: Option<&str>,
bytes: Option<Py<PyBytes>>,
bytes_le: Option<Py<PyBytes>>,
fields: Option<Py<PyTuple>>,
int: Option<u128>,
version: Option<u8>,
py: Python,
) -> PyResult<()> {...}
}
#[pymethods]
impl UUID {
// Here is no "clippy::too_many_arguments" allowed
fn other_method(...) {...}
...
} |
I guess that's a workaround but we should fix this bug anyway. |
Can't reproduce. @thedrow Could you try with the current master? |
This bug is fixed with 0.8.0. |
🐛 Bug Reports
When reporting a bug, please provide the following information. If this is not a bug report you can just discard this template.
🌍 Environment
rustc --version
): rustc 1.37.0-nightly (17e62f77f 2019-07-01)version = "0.x.y"
withgit = "https://github.com/PyO3/pyo3")?
I'm using 0.7.0. Haven't tried with master💥 Reproducing
This results in the following error:
I'd like to disable some clippy warnings which are not relevant in PyO3 or for my code.
This is currently not possible.
The text was updated successfully, but these errors were encountered: