dtolnay / dtolnay/anyhow

Default {} is confusing, while {:#} is much better

Open
#111 3 comments 20 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
6.7k
Forks
224
PR merge metrics
No merged PRs in 30d

Description

We've been using anyhow extensively, and it's worked out great. There's just one super confusing thing. I would expect:

```
println!("{}", anyhow!("My error message").context("on a file"))
```

To print at least `My error message`, and ideally `on a file`. But it just prints `on a file`. I know `{:#}` is available, but I've yet to find a case where we didn't want `{:#}` and the usage of `{}` is pretty pervasive - we've had it when printing messages nested, as format strings to `thiserror` etc. It is the bug we seem to make every single time. I appreciate compatibility constraints might be hard, but switching the two (or even making them both the same) would be easier to use.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.