whitequark / rust-xdg

A library that makes it easy to follow the X Desktop Group specifications
https://wiki.freedesktop.org/www/Specifications/
Apache License 2.0
146 stars 29 forks source link

Fix infinite recursion in `impl Display for BaseDirectoriesError` #42

Closed Shir0kamii closed 2 years ago

Shir0kamii commented 2 years ago

Hi!

I was randomly reading your code, when something catched my eye.

Since the trait ToString rely on the implementation of Display, calling self.to_string() inside a Display implementation result in an infinite loop.

I confirmed it through experimentation then implemented a simple fix.

whitequark commented 2 years ago

Thank you!