Replace InstrSeq::fold_left() with iter().fold()
commitad6a60c6655ee429e7913aa144e97b298e608c85
authorEdwin Smith <smith@fb.com>
Thu, 10 Feb 2022 17:07:22 +0000 (10 09:07 -0800)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Thu, 10 Feb 2022 17:08:44 +0000 (10 09:08 -0800)
treebd5ee7d2b3ff059329d292a64fc674066127d4f8
parent87aca6128cb85649d60af98dbc5aa26f0cb14f23
Replace InstrSeq::fold_left() with iter().fold()

Summary:
I noticed fold_left() is unnecessarily recursive and had un-idiomatic parameter order
(lambda params should be last). But it also re-implements Rust's Iterator::fold(),
so just do that. This enabled a number of simplifications at call sites.

Reviewed By: shayne-fletcher

Differential Revision: D34140145

fbshipit-source-id: fc10c326a656c51b3da9e1f35d7ecf9f01afdcba
hphp/hack/src/hackc/emitter/emit_statement.rs
hphp/hack/src/hackc/emitter/instruction_sequence.rs
hphp/hack/src/hackc/emitter/label_rewriter.rs
hphp/hack/src/hackc/emitter/try_finally_rewriter.rs