Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
I used a very powerful tool [coccinelle](https://gitlab.inria.fr/coccinelle/coccinelleforrust) (its C version is used for Linux kernel refactorings). Highly recommend installing it as it has a potential to simplify refactorings while not dealing with regex errors. To install it, run ```sh cargo install --git https://gitlab.inria.fr/coccinelle/coccinelleforrust ``` Afterward, create this file as `target/repl2.cocci` with the following content. Using `target/` ensures that it will be ignored by git. ```diff @@ expression i, end; @@ -i = 0usize; -while i < end +for i in 0usize..end -{ { ... } - i = i.wrapping_add(1); -} ``` and run this command from the root of the repo: ```shell cfr -c target/repl2.cocci src/ --apply cargo fmt --all ``` Afterwards, I compiled and removed all unused index variables.
- Loading branch information