Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format should not panic if you try to format it more than once #307

Open
zxqfl opened this issue Sep 14, 2018 · 1 comment
Open

Format should not panic if you try to format it more than once #307

zxqfl opened this issue Sep 14, 2018 · 1 comment

Comments

@zxqfl
Copy link

zxqfl commented Sep 14, 2018

Some logging frameworks will format things sent to the error! macro twice.

Some possible solutions:

  1. Print a "iterator exhausted" message instead of panicking
  2. Impose a Clone bound on the iterator being formatted so that we can format it multiple times
  3. Doesn't fmt return a Result anyway? Why not just return Err?
@bluss
Copy link
Member

bluss commented Nov 28, 2018

(3) From previous discussion I have understood that fmt's error return should not be used by the thing that is being formatted. It's used to relay the information that an I/O error happened through the formatting chain.

I don't know how to solve it, I think this is a drawback that comes from our skirting the rules a bit for formatting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants