Skip to content

Commit 9943e52

Browse files
authored
Update PyO3, clippy fixes (#228)
2 parents c4ee249 + b14c715 commit 9943e52

File tree

6 files changed

+28
-132
lines changed

6 files changed

+28
-132
lines changed

Cargo.lock

Lines changed: 11 additions & 122 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

color-eyre/src/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ pub struct Frame {
160160
#[derive(Debug)]
161161
struct StyledFrame<'a>(&'a Frame, Theme);
162162

163-
impl<'a> fmt::Display for StyledFrame<'a> {
163+
impl fmt::Display for StyledFrame<'_> {
164164
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
165165
let Self(frame, theme) = self;
166166

color-eyre/src/writers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ impl<'a, H: ?Sized, W> HeaderWriter<'a, H, W> {
6767
}
6868
}
6969

70-
impl<'a, H: ?Sized, W> fmt::Write for ReadyHeaderWriter<'a, '_, H, W>
70+
impl<H: ?Sized, W> fmt::Write for ReadyHeaderWriter<'_, '_, H, W>
7171
where
7272
H: Display,
7373
W: fmt::Write,

eyre/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ track-caller = []
2121
[dependencies]
2222
indenter = { workspace = true }
2323
once_cell = { workspace = true }
24-
pyo3 = { version = "0.20", optional = true, default-features = false }
24+
pyo3 = { version = "0.24.0", optional = true, default-features = false }
2525

2626
[build-dependencies]
2727
autocfg = { workspace = true }
@@ -34,7 +34,7 @@ trybuild = { version = "=1.0.89", features = ["diff"] } # pinned due to MSRV
3434
backtrace = "0.3.46"
3535
anyhow = "1.0.28"
3636
syn = { version = "2.0", features = ["full"] }
37-
pyo3 = { version = "0.20", default-features = false, features = ["auto-initialize"] }
37+
pyo3 = { version = "0.24", default-features = false, features = ["auto-initialize"] }
3838

3939
[package.metadata.docs.rs]
4040
targets = ["x86_64-unknown-linux-gnu"]

eyre/src/ptr.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ pub(crate) struct RefPtr<'a, T: ?Sized> {
7575
unsafe impl<'a, T: ?Sized> Send for RefPtr<'a, T> where &'a T: Send {}
7676
unsafe impl<'a, T: ?Sized> Sync for RefPtr<'a, T> where &'a T: Sync {}
7777

78-
impl<'a, T: ?Sized> Copy for RefPtr<'a, T> {}
79-
impl<'a, T: ?Sized> Clone for RefPtr<'a, T> {
78+
impl<T: ?Sized> Copy for RefPtr<'_, T> {}
79+
impl<T: ?Sized> Clone for RefPtr<'_, T> {
8080
fn clone(&self) -> Self {
8181
*self
8282
}
@@ -121,8 +121,8 @@ pub(crate) struct MutPtr<'a, T: ?Sized> {
121121
unsafe impl<'a, T: ?Sized> Send for MutPtr<'a, T> where &'a mut T: Send {}
122122
unsafe impl<'a, T: ?Sized> Sync for MutPtr<'a, T> where &'a mut T: Sync {}
123123

124-
impl<'a, T: ?Sized> Copy for MutPtr<'a, T> {}
125-
impl<'a, T: ?Sized> Clone for MutPtr<'a, T> {
124+
impl<T: ?Sized> Copy for MutPtr<'_, T> {}
125+
impl<T: ?Sized> Clone for MutPtr<'_, T> {
126126
fn clone(&self) -> Self {
127127
*self
128128
}

eyre/tests/test_pyo3.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
use pyo3::prelude::*;
44

55
use eyre::{bail, Result, WrapErr};
6+
use std::ffi::CStr;
67

78
fn f() -> Result<()> {
89
use std::io;
@@ -26,8 +27,14 @@ fn test_pyo3_exception_contents() {
2627
let pyerr = PyErr::from(err);
2728

2829
Python::with_gil(|py| {
29-
let locals = [("err", pyerr)].into_py_dict(py);
30-
let pyerr = py.run("raise err", None, Some(locals)).unwrap_err();
30+
let locals = [("err", pyerr)].into_py_dict(py).unwrap();
31+
let pyerr = py
32+
.run(
33+
CStr::from_bytes_with_nul(b"raise err\0").unwrap(),
34+
None,
35+
Some(&locals),
36+
)
37+
.unwrap_err();
3138
assert_eq!(pyerr.value(py).to_string(), expected_contents);
3239
})
3340
}

0 commit comments

Comments
 (0)