Auto merge of #47231 - ereslibre:clean-emitted-diagnostics, r=nrc
Auto merge of #47231 - ereslibre:clean-emitted-diagnostics, r=nrc

Clean emitted diagnostics when `reset_err_count` is called.

When external tools like `rustfmt` calls to `reset_err_count` for handler
reusing, it will set the error count on the handler to 0, but since
https://github.com/rust-lang/rust/pull/47146 the handler will contain
status that will prevent the error count to be bumped if this handler is
reused.

This caused `rustfmt` idempotency tests to fail:
https://github.com/rust-lang-nursery/rustfmt/issues/2338

Fixes: https://github.com/rust-lang-nursery/rustfmt/issues/2338

GBGamer/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,GBGamer/rust,aidancully/rust,GBGamer/rust,GBGamer/rust,graydon/rust,aidancully/rust,aidancully/rust,graydon/rust,GBGamer/rust,GBGamer/rust,graydon/rust,GBGamer/rust,aidancully/rust,graydon/rust,GBGamer/rust