I’ve tried to implement automatic cleanups, even incorrect ones, in my C to Rust converter. I don’t think much can be done automatically beyond cosmetic changes, such as making nicer for loops instead of while, and replacing *mut T with &T in a few obvious places.
The main problem is that information required to apply bigger transformation just doesn’t exist in the C code. For example very few places can be changed to slices. I’ve found it’s common in C to give a pointer to an array without an explicit length. The length is “known” from context too opaque for the compiler to figure out.
And there are much bigger refactorings that are even harder, e.g. functions should take &mut Write instead of *mut u8 to write to a buffer, or perhaps return Vec instead of doing some caller-allocated-buffer dance.
So my hope here is: forget about C. Make good Rust refactoring tools, because C-style code in Rust’s skin is going to need a major reorganization.