diff --git a/godot-macros/src/util/list_parser.rs b/godot-macros/src/util/list_parser.rs index 8056034fa..4a2eb6743 100644 --- a/godot-macros/src/util/list_parser.rs +++ b/godot-macros/src/util/list_parser.rs @@ -126,24 +126,14 @@ impl ListParser { /// /// Returns `Ok(None)` if there are no more elements left. pub fn next_ident(&mut self) -> ParseResult> { - let Some(kv) = self.pop_next() else { - return Ok(None); - }; - - Ok(Some(kv.ident()?)) + self.pop_next().map(|kv| kv.ident()).transpose() } /// Check if the next element of the list is an identifier. /// /// Returns `None` if there are no more elements left, `Some(true)` if the next element is identifier and `Some(false)` if it is not. pub fn is_next_ident(&mut self) -> Option { - let Some(kv) = self.peek() else { - return None; - }; - - let res = kv.as_ident(); - - Some(res.is_ok()) + Some(self.peek()?.as_ident().is_ok()) } /// Take the next element of the list, if it is an identifier.