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