Skip to content

Show warnings in output of live editor #1328

Closed
@Riezebos

Description

@Riezebos

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions