clippy: fixes flagged by beta toolchain

This commit is contained in:
David Hewitt 2022-08-14 07:44:11 +01:00
parent b389a6ba4d
commit de8fa18946
2 changed files with 3 additions and 7 deletions

View File

@ -12,9 +12,7 @@ fn bench_clean_gilpool_new(b: &mut Bencher<'_>) {
fn bench_clean_acquire_gil(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. // Acquiring first GIL will also create a "clean" GILPool, so this measures the Python overhead.
b.iter(|| { b.iter(|| Python::with_gil(|_| {}));
let _ = Python::with_gil(|_| {});
});
} }
fn bench_dirty_acquire_gil(b: &mut Bencher<'_>) { 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. // Clone and drop an object so that the GILPool has work to do.
let _ = obj.clone(); let _ = obj.clone();
}, },
|_| { |_| Python::with_gil(|_| {}),
let _ = Python::with_gil(|_| {});
},
BatchSize::NumBatches(1), BatchSize::NumBatches(1),
); );
} }

View File

@ -743,7 +743,7 @@ mod tests {
let obj: Arc<Py<PyAny>> = Arc::new(get_object(py)); let obj: Arc<Py<PyAny>> = Arc::new(get_object(py));
let thread_obj = Arc::clone(&obj); let thread_obj = Arc::clone(&obj);
let count = (&*obj).get_refcnt(py); let count = obj.get_refcnt(py);
println!( println!(
"1: The object has been created and its reference count is {}", "1: The object has been created and its reference count is {}",
count count