Remove cfg option_insert made unnecessary by MSRV bump.

This commit is contained in:
Adam Reichold 2023-06-05 09:37:13 +02:00
parent b49e401319
commit f7bd6ce224
2 changed files with 0 additions and 19 deletions

View File

@ -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");

View File

@ -50,13 +50,6 @@ pub fn extract_pyclass_ref<'a, 'py: 'a, T: PyClass>(
obj: &'py PyAny,
holder: &'a mut Option<PyRef<'py, T>>,
) -> 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<Frozen = False>>(
obj: &'py PyAny,
holder: &'a mut Option<PyRefMut<'py, T>>,
) -> 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()?))
}