From f7bd6ce224030ae3683793f8940516b331b6626a Mon Sep 17 00:00:00 2001 From: Adam Reichold Date: Mon, 5 Jun 2023 09:37:13 +0200 Subject: [PATCH] Remove cfg option_insert made unnecessary by MSRV bump. --- pyo3-build-config/src/lib.rs | 5 ----- src/impl_/extract_argument.rs | 14 -------------- 2 files changed, 19 deletions(-) diff --git a/pyo3-build-config/src/lib.rs b/pyo3-build-config/src/lib.rs index f870daa7..7ab24ee3 100644 --- a/pyo3-build-config/src/lib.rs +++ b/pyo3-build-config/src/lib.rs @@ -152,11 +152,6 @@ pub fn print_feature_cfgs() { println!("cargo:rustc-cfg=addr_of"); } - // Enable use of Option::insert on Rust 1.53 and greater - if rustc_minor_version >= 53 { - println!("cargo:rustc-cfg=option_insert"); - } - // Enable use of const initializer for thread_local! on Rust 1.59 and greater if rustc_minor_version >= 59 { println!("cargo:rustc-cfg=thread_local_const_init"); diff --git a/src/impl_/extract_argument.rs b/src/impl_/extract_argument.rs index dd361e4b..764a4e3c 100644 --- a/src/impl_/extract_argument.rs +++ b/src/impl_/extract_argument.rs @@ -50,13 +50,6 @@ pub fn extract_pyclass_ref<'a, 'py: 'a, T: PyClass>( obj: &'py PyAny, holder: &'a mut Option>, ) -> PyResult<&'a T> { - #[cfg(not(option_insert))] - { - *holder = Some(obj.extract()?); - return Ok(holder.as_deref().unwrap()); - } - - #[cfg(option_insert)] Ok(&*holder.insert(obj.extract()?)) } @@ -65,13 +58,6 @@ pub fn extract_pyclass_ref_mut<'a, 'py: 'a, T: PyClass>( obj: &'py PyAny, holder: &'a mut Option>, ) -> PyResult<&'a mut T> { - #[cfg(not(option_insert))] - { - *holder = Some(obj.extract()?); - return Ok(holder.as_deref_mut().unwrap()); - } - - #[cfg(option_insert)] Ok(&mut *holder.insert(obj.extract()?)) }