Skip to content

Commit

Permalink
fix nightly ci
Browse files Browse the repository at this point in the history
  • Loading branch information
Icxolu committed Jul 27, 2024
1 parent 1ca484d commit b08edae
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 1 deletion.
2 changes: 2 additions & 0 deletions guide/src/class.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -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,
Expand Down
10 changes: 10 additions & 0 deletions guide/src/class/object.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -102,6 +103,7 @@ For convenience, a shorthand format string can be passed to `str` as `str="<form
```rust
# use pyo3::prelude::*;
#
# #[allow(dead_code)]
# #[pyclass(str="({x}, {y}, {z})")]
# struct Coordinate {
x: i32,
Expand All @@ -122,6 +124,7 @@ the subclass name. This is typically done in Python code by accessing
# use pyo3::prelude::*;
# use pyo3::types::PyString;
#
# #[allow(dead_code)]
# #[pyclass]
# struct Number(i32);
#
Expand Down Expand Up @@ -150,6 +153,7 @@ use std::hash::{Hash, Hasher};

# use pyo3::prelude::*;
#
# #[allow(dead_code)]
# #[pyclass]
# struct Number(i32);
#
Expand All @@ -170,6 +174,7 @@ method it should not define a `__hash__()` operation either"
```rust
# use pyo3::prelude::*;
#
# #[allow(dead_code)]
#[pyclass(frozen, eq, hash)]
#[derive(PartialEq, Hash)]
struct Number(i32);
Expand Down Expand Up @@ -213,6 +218,7 @@ use pyo3::class::basic::CompareOp;
# use pyo3::prelude::*;
#
# #[allow(dead_code)]
# #[pyclass]
# struct Number(i32);
#
Expand All @@ -239,6 +245,7 @@ use pyo3::class::basic::CompareOp;

# use pyo3::prelude::*;
#
# #[allow(dead_code)]
# #[pyclass]
# struct Number(i32);
#
Expand Down Expand Up @@ -285,6 +292,7 @@ To implement `__eq__` using the Rust [`PartialEq`] trait implementation, the `eq
```rust
# use pyo3::prelude::*;
#
# #[allow(dead_code)]
#[pyclass(eq)]
#[derive(PartialEq)]
struct Number(i32);
Expand All @@ -295,6 +303,7 @@ To implement `__lt__`, `__le__`, `__gt__`, & `__ge__` using the Rust `PartialOrd
```rust
# use pyo3::prelude::*;
#
# #[allow(dead_code)]
#[pyclass(eq, ord)]
#[derive(PartialEq, PartialOrd)]
struct Number(i32);
Expand All @@ -307,6 +316,7 @@ We'll consider `Number` to be `True` if it is nonzero:
```rust
# use pyo3::prelude::*;
#
# #[allow(dead_code)]
# #[pyclass]
# struct Number(i32);
#
Expand Down
1 change: 1 addition & 0 deletions guide/src/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ done with the `crate` attribute:
# use pyo3::prelude::*;
# pub extern crate pyo3;
# mod reexported { pub use ::pyo3; }
# #[allow(dead_code)]
#[pyclass]
#[pyo3(crate = "reexported::pyo3")]
struct MyClass;
Expand Down
1 change: 1 addition & 0 deletions src/conversion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ pub trait ToPyObject {
/// ```rust
/// use pyo3::prelude::*;
///
/// # #[allow(dead_code)]
/// #[pyclass]
/// struct Number {
/// #[pyo3(get, set)]
Expand Down
5 changes: 4 additions & 1 deletion src/types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,10 @@ macro_rules! pyobject_native_type_named (
#[macro_export]
macro_rules! pyobject_native_static_type_object(
($typeobject:expr) => {
|_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) }
}
};
);

Expand Down

0 comments on commit b08edae

Please sign in to comment.