~matthiasbeyer/serde-select

7618ca3e231921a354ce47b0b79adfee24f48b4f — Matthias Beyer 4 years ago 09432a8
If there is no token anymore, we can return the object itself

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
1 files changed, 1 insertions(+), 5 deletions(-)

M src/resolver.rs
M src/resolver.rs => src/resolver.rs +1 -5
@@ 40,11 40,7 @@ pub fn resolve<'doc, O>(obj: &'doc O, tokens: &Token, error_if_not_found: bool)
                            Ok(None)
                        }
                    },
                    None => {
                        ary.at_index(*idx).ok_or_else(|| {
                            Error::IndexOutOfBounds(*idx, obj.array_len().unwrap()) // unwrap is safe here
                        })
                    }
                    None => Ok(Some(obj)),
                },
                Token::Identifier { ref ident, .. } => Err(Error::NoIdentifierInArray(ident.clone())),
            }