Rollup merge of #81795 - camsteffen:diagnostics-reduce, r=oli-obk
Rollup merge of #81795 - camsteffen:diagnostics-reduce, r=oli-obk

Small refactor with Iterator::reduce

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