We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 59fa46d + 737ec52 commit 61e752eCopy full SHA for 61e752e
vm/src/function.rs
@@ -85,17 +85,14 @@ impl PyFuncArgs {
85
}
86
87
pub fn get_kwarg(&self, key: &str, default: PyObjectRef) -> PyObjectRef {
88
- if let Some(kwarg_value) = self.kwargs.get(key) {
89
- return kwarg_value.clone();
90
- }
91
- default.clone()
+ self.kwargs
+ .get(key)
+ .cloned()
+ .unwrap_or_else(|| default.clone())
92
93
94
pub fn get_optional_kwarg(&self, key: &str) -> Option<PyObjectRef> {
95
96
- return Some(kwarg_value.clone());
97
98
- None
+ self.kwargs.get(key).cloned()
99
100
101
pub fn get_optional_kwarg_with_type(
0 commit comments