immunant / c2rust

Migrate C code to Rust
https://c2rust.com/
Other
3.91k stars 229 forks source link

analyze: refactor `rewrite::apply` #937

Closed spernsteiner closed 1 year ago

spernsteiner commented 1 year ago

This branch refactors rewrite::apply and the Rewrite type's Display impl so that (1) the main "emit Rewrite" function is easier to extend (no more closures) and (2) the Display impl can reuse the rewrite::apply code so we don't have to implement every Rewrite variant twice. The precise design of the new Sink and Emitter types is not very clear, but it achieves the goals above and should work well enough for now.