Getting the program's first argument as a number I want to get the first argument as a number, if there is any. This does not feel quite right, but I don't know yet what the Rust way would be.

I'm not searching for a args-framework or something, I just want to get a grip on doing stuff with Rust.

fn limit_from_args(args: env::Args) -&gt; i32 {
    let args: Vec&lt;String&gt; = args.collect();
    if args.len() &gt; 1 {
        match args[1].parse::&lt;i32&gt;() {
            Ok(i) =&gt; i + 1,
            Err(_) =&gt; 101,
        }
    } else {
        101
    }
}
There's always multiple ways to solve a problem, but if we keep your function signature unchanged, I'd probably write something like:

use std::env;

fn limit_from_args(mut args: env::Args) -&gt; i32 {
    args.nth(1).and_then(|v| v.parse().ok()).unwrap_or(101)
}

fn main() {}


Notable things with your first solution:


There's no need to specify the String type when collecting; you can just use Vec&lt;_&gt;.
Since only one argument is needed, the code will be more efficient if that's all we look at. If there were thousands of arguments, there's no need to allocate space for 99% of them and then throw that away.
If you did have a slice or a vector, you can combine the range check and getting the value into one call with slice::get. This avoids the extra overhead of checking the index against the range:

match args.get(1) {
    Some(val) =&gt; ...,
    None =&gt; ...,
}

There's probably no need to specify the type for parse, it should be inferred from the return type.
Since the error codes are repeated, they should probably be extracted to a constant with a meaningful name. Even if they weren't repeated, 101 looks like a magic number.