charlesvdv / nom-bibtex

A feature complete bibtex parser using nom
https://docs.rs/nom-bibtex
MIT License
22 stars 15 forks source link

Fix infinite recursion in BibtexError Display impl #15

Closed jonasmalacofilho closed 2 years ago

jonasmalacofilho commented 2 years ago

Calling me.to_string() from display(me) resulted in infinite recursion and overflowed the stack.

$ cargo test
[...]
thread 'error::tests::test_display_impls' has overflowed its stack
fatal runtime error: stack overflow

This PR removes the recursion to solve the issue, and adds a test case for that (implicit) Display impl.

Additionally, since std::error::Error::description() has been deprecated, its implementation has also been removed.

charlesvdv commented 2 years ago

Thanks for the fix!