3 ms·
So before anyone chimes in and asks why the title (or the OP) feels the need to point out that this was written in rust and perhaps any upvotes this submission
by ComputerGuru 10y ago
So before anyone chimes in and asks why the title (or the OP) feels the need to point out that this was written in rust and perhaps any upvotes this submission has garnered are just from the rust fanclub.. you're right, I mostly wrote this in rust because of a desire to further familiarize myself with the language (it's been a year since I last used it).
However, I was going to write this anyway as it satisfies an itch I've had for a while. I had an implementation of `rewrite` as a bash script previously, but was not satisfied with it because I'm using `rewrite` in critical parts of my workflow and just don't trust bash the same way I do rust (or C/C++ or any other language, for that matter).
If you're also new to there are a few new things I've learned about rust that show up in the commit history (though not as much as I would have liked). In particular, using .expect() and .to_string_lossy() to avoid using .unwrap() directly (except where user input isn't a possible cause of failure). I had some try! code in there that was replaced by the new ? operator (not to be confused with the same operator in other languages like C#, the ? in rust is more of an inline try..catch rather than a null test/coalescing operator) but that code didn't even make the first commit.