I believe this is definitely possible (comparing the iterators of each), and I suspect that there's a more efficient method as well. See this documentation PR where it simplifies the code: https://github.com/rust-lang/rust/pull/38581/files#diff-266e22074e3b36596081857cbf5b1513R1256.