replace unwrap_or with unwrap_or_else

This commit is contained in:
Robert Booth
2021-04-25 07:12:30 +09:00
parent af6b230dad
commit 6a293b2e47

View File

@@ -390,7 +390,8 @@ where
obj.downcast()
.map_err(|obj| pyref_payload_error(vm, class, obj))
} else {
T::special_retrieve(vm, obj.clone()).unwrap_or(Err(pyref_type_error(vm, class, obj)))
T::special_retrieve(vm, obj.clone())
.unwrap_or_else(|| Err(pyref_type_error(vm, class, obj)))
}
}
}