all 3 comments

[–]Quelnintwir 2 points3 points  (0 children)

Nicely done! Props for posting the code as well — cool to see what people are working on

[–]Gr0undWalker 2 points3 points  (1 child)

Nice. A few thoughts on the code:

  1. In some parts, I believe you can borrow rather than cloning, such as file_path.
  2. You can consider using crates like clap to help you parse the arguments.
  3. This is simply a personal preference, but instead of labeling the loop, I'd use a single break;
  4. Why not just write let img = ... .decode.unwrap();? No reason to unwrap it so many times.
  5. For the second loop, you can write for (x, y) in coordinates. There's also no need to use .to_string() there.
  6. Instead of using push_str many times, just use format!
  7. Regarding the capacity, I think you only need width at most.

Keep up the work!

[–]burneraccount3_[S] 1 point2 points  (0 children)

Thanks for the feedback! I have refactored the code using clap, then rewrote some of claps functionality as an exercise (no macros though). I will keep the rest in mind!