Closed mahmoud-moursy closed 1 month ago
Thank you for the well-written ticket!
You're quite right that we're not respecting that flag currently; I've filed RUST-2019 to track that. This won't be high priority in our plan for this quarter but we'd certainly welcome a contribution to add it 🙂
Versions/Environment
rustc 1.82.0-nightly (506052d49 2024-08-16)
Linux
cargo pkgid mongodb
&cargo pkgid bson
)bson
:registry+https://github.com/rust-lang/crates.io-index#bson@2.11.0
mongodb
: N/Adb.version()
) N/ADescribe the bug
A clear and concise description of what the bug is.
BE SPECIFIC:
Bson
formatting outputs the following:What actually happens:
Bson
formatting outputs the following:If you implemented
Display
manually, then you need to manually check if the user passed in pretty-printing as a parameter and then change your formatting based on that.You can check it using
formatter.alternate()
in yourDisplay
implementation.{:#?}
produces correctly-formatted output.let bson_document = bson::to_document(&my_hashmap);
// Incorrect formatting: println!("{bson_document:#}");
// This, however, is correctly formatted: println!("{bson_document:#?}"); // It is probably correctly formatted because the derive(Debug) implementation was used.