rust-lang/rust-by-example

? operator should be in the first, not last, sub-section of 18.4. Result

Opened this issue · 0 comments

Since the ? operator is in the last sub-section of 18.4. Result, all the other sub-sections and the main section are filled with code of the type:

let number = match number_str.parse::<i32>() {
    Ok(number)  => number,
    Err(e) => return Err(e),
};

This is really confusing. Especially for someone who is reading the sections in order because in 18.3. Option & unwrap, the ? operator is in the first sub-section. You are telling the reader what the good way of doing something is but then giving him 4 sections of code written in what you just described as the worse way of doing it...