From 7a2b1f0e133089e17c09d664cb4c0b59a19b1e22 Mon Sep 17 00:00:00 2001 From: David Hewitt <1939362+davidhewitt@users.noreply.github.com> Date: Tue, 28 Feb 2023 08:44:17 +0000 Subject: [PATCH] fix `non_snake_case` lint for `#[pyfunction]` generated code --- newsfragments/2993.fixed.md | 1 + pyo3-macros-backend/src/pyfunction.rs | 1 + tests/test_methods.rs | 1 - 3 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 newsfragments/2993.fixed.md diff --git a/newsfragments/2993.fixed.md b/newsfragments/2993.fixed.md new file mode 100644 index 00000000000..130385fb787 --- /dev/null +++ b/newsfragments/2993.fixed.md @@ -0,0 +1 @@ +Fix `non_snake_case` lint fired by generated code in `#[pyfunction]` macro. diff --git a/pyo3-macros-backend/src/pyfunction.rs b/pyo3-macros-backend/src/pyfunction.rs index c4c6845acc0..d0a5b6c1f18 100644 --- a/pyo3-macros-backend/src/pyfunction.rs +++ b/pyo3-macros-backend/src/pyfunction.rs @@ -457,6 +457,7 @@ pub fn impl_wrap_pyfunction( const DEF: #krate::impl_::pyfunction::PyMethodDef = #methoddef; } + #[allow(non_snake_case)] #wrapper }; }; diff --git a/tests/test_methods.rs b/tests/test_methods.rs index 9810e92ad14..effd25a1be1 100644 --- a/tests/test_methods.rs +++ b/tests/test_methods.rs @@ -1545,7 +1545,6 @@ fn test_option_pyclass_arg() { } #[test] -#[allow(non_snake_case)] // FIXME __pyfunction__foo expanded symbol is not snake case fn test_issue_2988() { #[pyfunction] #[pyo3(signature = (