mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-02 03:33:59 +00:00
37 lines
439 B
Rust
37 lines
439 B
Rust
//@ run-rustfix
|
|
//@ check-pass
|
|
|
|
#![warn(unused_must_use)]
|
|
|
|
#[must_use]
|
|
fn foo() -> i32 {
|
|
42
|
|
}
|
|
|
|
fn bar() {
|
|
{
|
|
foo();
|
|
//~^ WARN unused return value
|
|
}
|
|
}
|
|
|
|
fn baz() {
|
|
{
|
|
foo()
|
|
//~^ WARN unused return value
|
|
};
|
|
}
|
|
|
|
fn main() {
|
|
bar();
|
|
baz();
|
|
{
|
|
1 + 2;
|
|
//~^ WARN unused arithmetic operation
|
|
}
|
|
{
|
|
1 + 2
|
|
//~^ WARN unused arithmetic operation
|
|
};
|
|
}
|