Skip to content

Commit 4a84c68

Browse files
committed
remove redundant logic
1 parent d3fd01f commit 4a84c68

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

src/lookup_key.rs

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,13 @@ impl LookupKey {
241241
obj: &Bound<'py, PyAny>,
242242
kwargs: Option<&Bound<'py, PyDict>>,
243243
) -> ValResult<Option<(&'s LookupPath, Bound<'py, PyAny>)>> {
244-
match self._py_get_attr(obj, kwargs) {
244+
if let Some(dict) = kwargs {
245+
if let Ok(Some(item)) = self.py_get_dict_item(dict) {
246+
return Ok(Some(item));
247+
}
248+
}
249+
250+
match self.simple_py_get_attr(obj) {
245251
Ok(v) => Ok(v),
246252
Err(err) => {
247253
let error = py_err_string(obj.py(), err);
@@ -253,20 +259,6 @@ impl LookupKey {
253259
}
254260
}
255261

256-
pub fn _py_get_attr<'py, 's>(
257-
&'s self,
258-
obj: &Bound<'py, PyAny>,
259-
kwargs: Option<&Bound<'py, PyDict>>,
260-
) -> PyResult<Option<(&'s LookupPath, Bound<'py, PyAny>)>> {
261-
if let Some(dict) = kwargs {
262-
if let Ok(Some(item)) = self.py_get_dict_item(dict) {
263-
return Ok(Some(item));
264-
}
265-
}
266-
267-
self.simple_py_get_attr(obj)
268-
}
269-
270262
pub fn json_get<'a, 'data, 's>(
271263
&'s self,
272264
dict: &'a JsonObject<'data>,

0 commit comments

Comments
 (0)