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

Show warnings in output of live editor #1328

Closed
Riezebos opened this issue Apr 8, 2020 · 2 comments
Closed

Show warnings in output of live editor #1328

Riezebos opened this issue Apr 8, 2020 · 2 comments

Comments

@Riezebos
Copy link

Riezebos commented Apr 8, 2020

Thanks for the great book! I was just getting started, trying to learn some Rust.

In /hello/print/print_display/testcase_list I was a bit confused about the ? and was wondering why it is needed. I removed all the ? after the write statements, expecting some error to pop up that would make it more clear why these question marks are added. The output was exactly the same as before.

After years of seeing people say all kinds of (mostly nice) things about about rust, I had a hunch that this was not intended. So I installed rust on my laptop and reran the program. Now i got two very clear warnings:

warning: unused `std::result::Result` that must be used
  --> main.rs:12:9
   |
12 |         write!(f, "[");
   |         ^^^^^^^^^^^^^^^
   |
   = note: `#[warn(unused_must_use)]` on by default
   = note: this `Result` may be an `Err` variant, which should be handled
   = note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

My way of trial and error learning might not be the same as others, but it would definitely have helped me here to see this warning in the output. If others feel the same way I would propose to show warnings. (Maybe below the output and slightly lighter or darker)

@xiaochuanyu
Copy link
Contributor

This book uses mdbook to generate the website and there is a limitation within that tool which ignores warnings when you run Rust code blocks. I've made a PR for mdbook that tries to address this issue rust-lang/mdBook#1315.

@wooorm
Copy link

wooorm commented Feb 9, 2022

Bumping because I just ran into the same! (and you closed that issue 😅)

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

4 participants