I moved argument parsing out of main into src/lib.rs. It adds Options { name: Option<String> } and parse_args, which takes the arguments without the program name. Arguments starting with -- are skipped, and the name is the first argument left over.
main now calls parse_args(env::args().skip(1)) and falls back to the USER env var and then world, as before. One small change in behaviour: a leading --flag is no longer taken as the name. Previously it would have been.
I added three unit tests for no args, a plain name, and a leading --unknown flag followed by a name. cargo build and cargo test both pass. I didn't run the binary by hand.