rust-cli / book

Documentation on how to use the Rust Programming Language to develop commandline applications
https://rust-cli.github.io/book/index.html
MIT License
816 stars 108 forks source link

Improve the "Parsing command-line arguments" chapter #234

Closed stomar closed 10 months ago

stomar commented 10 months ago

Make each example runnable without any warnings: add a println statement that also provides immediate feedback, instead of using allow(unused) attributes that are hidden from the reader.

Also, move the explanation on passing arguments when using cargo run up to the first example, enabling beginners to run each code iteration, instead of only the final code.

Remove the exercise that doesn't make sense anymore.

stomar commented 10 months ago

To explain further: when I learn new concepts, I like to try out each (small) code iteration, instead of reading through a complete post or chapter, and only running the final code version.

The first thing a beginner will get when trying this here, is a warning... :scream:

Also, the explanation on using cargo run is given too late.

So, I think, beginners will profit from this change, while more advanced readers shouldn't mind them (and the exercise wouldn't be of any use to them).

stomar commented 10 months ago

wow that was fast :smile:

Thanks.