add `#[doc(hidden)]` to the Rust module created by `#[pymodule]` (#4067)
* add `#[doc(hidden)]` to the Rust module created by `#[pymodule]` * add newsfragment
This commit is contained in:
parent
e174a04bb3
commit
fd18955da8
|
@ -0,0 +1 @@
|
||||||
|
fixes `missing_docs` lint to trigger on documented `#[pymodule]` functions
|
|
@ -324,6 +324,7 @@ pub fn pymodule_function_impl(mut function: syn::ItemFn) -> Result<TokenStream>
|
||||||
|
|
||||||
Ok(quote! {
|
Ok(quote! {
|
||||||
#function
|
#function
|
||||||
|
#[doc(hidden)]
|
||||||
#vis mod #ident {
|
#vis mod #ident {
|
||||||
#initialization
|
#initialization
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,4 +53,5 @@ fn test_compile_errors() {
|
||||||
#[cfg(feature = "experimental-async")]
|
#[cfg(feature = "experimental-async")]
|
||||||
#[cfg(any(not(Py_LIMITED_API), Py_3_10))] // to avoid PyFunctionArgument for &str
|
#[cfg(any(not(Py_LIMITED_API), Py_3_10))] // to avoid PyFunctionArgument for &str
|
||||||
t.compile_fail("tests/ui/invalid_cancel_handle.rs");
|
t.compile_fail("tests/ui/invalid_cancel_handle.rs");
|
||||||
|
t.pass("tests/ui/pymodule_missing_docs.rs");
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
#![deny(missing_docs)]
|
||||||
|
//! Some crate docs
|
||||||
|
|
||||||
|
use pyo3::prelude::*;
|
||||||
|
|
||||||
|
/// Some module documentation
|
||||||
|
#[pymodule]
|
||||||
|
pub fn python_module(_m: &Bound<'_, PyModule>) -> PyResult<()> {
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
Loading…
Reference in New Issue