Example:
fn main() {
let mut buffer = Vec::new();
writeln!(&mut buffer, "foo").unwrap();
}
This errors as:
<std macros>:2:20: 2:66 warning: use of unstable library feature 'io'
<std macros>:2 ( & mut * $ dst ) . write_fmt ( format_args ! ( $ ( $ arg ) * ) ) )
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<std macros>:2:20: 2:66 help: add #![feature(io)] to the crate attributes to silence this warning
<std macros>:2 ( & mut * $ dst ) . write_fmt ( format_args ! ( $ ( $ arg ) * ) ) )
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Contrast that with the error when the .unwrap() is removed:
<std macros>:2:1: 2:66 warning: unused result which must be used, #[warn(unused_must_use)] on by default
<std macros>:2 ( & mut * $ dst ) . write_fmt ( format_args ! ( $ ( $ arg ) * ) ) )
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<std macros>:1:1: 2:68 note: in expansion of write!
<std macros>:2:1: 2:46 note: expansion site
<std macros>:1:1: 4:66 note: in expansion of writeln!
src/main.rs:3:5: 3:34 note: expansion site
This can be pretty hairy to find if the project has many crates (my project euler repo, which is where I observed this, has 60+ executables).
Example:
This errors as:
Contrast that with the error when the
.unwrap()is removed:This can be pretty hairy to find if the project has many crates (my project euler repo, which is where I observed this, has 60+ executables).