Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect code example(s) in the book #29533

Closed
CirclePixel opened this issue Nov 3, 2015 · 0 comments
Closed

Incorrect code example(s) in the book #29533

CirclePixel opened this issue Nov 3, 2015 · 0 comments

Comments

@CirclePixel
Copy link

The "Error Handling" section of the book has a code example error under the "Adding Functionality" section: https://doc.rust-lang.org/book/error-handling.html#adding-functionality

the second code example shows the use of a macro named "fatal!" which does not exist:

match search(&args.arg_data_path, &args.arg_city) {
    Err(CliError::NotFound) if args.flag_quiet => process::exit(1),
    Err(err) => fatal!("{}", err),
    Ok(pops) => for pop in pops {
        println!("{}, {}: {:?}", pop.city, pop.country, pop.count);
    }
}

and (on a much more minor scale) the code sample directly above has a misspelling of the word "quiet" as "quit":

opts.optflag("q", "quit", "Silences errors and warnings.");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants