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

Error in code snippet in Chapter 14.3 #2560

Closed
michaelrevans opened this issue Jan 8, 2021 · 2 comments · Fixed by #2569
Closed

Error in code snippet in Chapter 14.3 #2560

michaelrevans opened this issue Jan 8, 2021 · 2 comments · Fixed by #2569

Comments

@michaelrevans
Copy link

In Chapter 14.3, the example gives add-one/src/lib.rs as


#![allow(unused)]
fn main() {
pub fn add_one(x: i32) -> i32 {
    x + 1
}
}

but it should be without main, like

pub fn add_one(x: i32) -> i32 {
    x + 1
}

The listing it references is correct, so there must be some other behaviour adding the surrounding main function that needs to be disabled/removed.], hence why I'm opening an issue not a PR

@steveklabnik
Copy link
Member

Yes, this is a standard thing rustdoc does. If we wanted to, we could modify the example so it's not shown that way. There are some other tickets about similar stuff elsewhere on the tracker.

@carols10cents
Copy link
Member

Thanks! I found a hack for this but missed a whole bunch of spots... thank you for helping me find them!

joeljpresent pushed a commit to joeljpresent/rust-book-fr that referenced this issue Apr 13, 2021
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

Successfully merging a pull request may close this issue.

3 participants