From de8fa18946a6e6b4291a1558b3fb0093650cd470 Mon Sep 17 00:00:00 2001 From: David Hewitt <1939362+davidhewitt@users.noreply.github.com> Date: Sun, 14 Aug 2022 07:44:11 +0100 Subject: [PATCH] clippy: fixes flagged by beta toolchain --- benches/bench_gil.rs | 8 ++------ src/gil.rs | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/benches/bench_gil.rs b/benches/bench_gil.rs index 1ef515d9..e7290644 100644 --- a/benches/bench_gil.rs +++ b/benches/bench_gil.rs @@ -12,9 +12,7 @@ fn bench_clean_gilpool_new(b: &mut Bencher<'_>) { fn bench_clean_acquire_gil(b: &mut Bencher<'_>) { // Acquiring first GIL will also create a "clean" GILPool, so this measures the Python overhead. - b.iter(|| { - let _ = Python::with_gil(|_| {}); - }); + b.iter(|| Python::with_gil(|_| {})); } fn bench_dirty_acquire_gil(b: &mut Bencher<'_>) { @@ -24,9 +22,7 @@ fn bench_dirty_acquire_gil(b: &mut Bencher<'_>) { // Clone and drop an object so that the GILPool has work to do. let _ = obj.clone(); }, - |_| { - let _ = Python::with_gil(|_| {}); - }, + |_| Python::with_gil(|_| {}), BatchSize::NumBatches(1), ); } diff --git a/src/gil.rs b/src/gil.rs index 37e0ed24..31c28aee 100644 --- a/src/gil.rs +++ b/src/gil.rs @@ -743,7 +743,7 @@ mod tests { let obj: Arc> = Arc::new(get_object(py)); let thread_obj = Arc::clone(&obj); - let count = (&*obj).get_refcnt(py); + let count = obj.get_refcnt(py); println!( "1: The object has been created and its reference count is {}", count