diff --git a/guide/src/class.md b/guide/src/class.md index 3a6f3f9f36c..216838f779d 100644 --- a/guide/src/class.md +++ b/guide/src/class.md @@ -549,6 +549,7 @@ For simple cases where a member variable is just read and written with no side e ```rust # use pyo3::prelude::*; +# #[allow(dead_code)] #[pyclass] struct MyClass { #[pyo3(get, set)] @@ -1360,6 +1361,7 @@ The `#[pyclass]` macro expands to roughly the code seen below. The `PyClassImplC # #[cfg(not(feature = "multiple-pymethods"))] { # use pyo3::prelude::*; // Note: the implementation differs slightly with the `multiple-pymethods` feature enabled. +# #[allow(dead_code)] struct MyClass { # #[allow(dead_code)] num: i32, diff --git a/guide/src/class/object.md b/guide/src/class/object.md index e2565427838..07f445aac60 100644 --- a/guide/src/class/object.md +++ b/guide/src/class/object.md @@ -76,6 +76,7 @@ To automatically generate the `__str__` implementation using a `Display` trait i # use std::fmt::{Display, Formatter}; # use pyo3::prelude::*; # +# #[allow(dead_code)] # #[pyclass(str)] # struct Coordinate { x: i32, @@ -102,6 +103,7 @@ For convenience, a shorthand format string can be passed to `str` as `str="
{ - |_py| unsafe { ::std::ptr::addr_of_mut!($typeobject) } + |_py| { + #[allow(unused_unsafe)] // https://github.com/rust-lang/rust/pull/125834 + unsafe { ::std::ptr::addr_of_mut!($typeobject) } + } }; );