mirror of
https://github.com/rust-lang/rust.git
synced 2025-10-02 18:27:37 +00:00
61 lines
1.3 KiB
Rust
61 lines
1.3 KiB
Rust
// Makes sure the suggestions of the `unused_must_use` lint are not inside
|
|
//
|
|
// See <https://github.com/rust-lang/rust/issues/143025>
|
|
|
|
//@ check-pass
|
|
//@ run-rustfix
|
|
|
|
#![expect(unused_macros)]
|
|
#![warn(unused_must_use)]
|
|
|
|
fn main() {
|
|
{
|
|
macro_rules! cmp {
|
|
($a:tt, $b:tt) => {
|
|
$a == $b
|
|
};
|
|
}
|
|
|
|
// FIXME(Urgau): For some unknown reason the spans we get are not
|
|
// recorded to be from any expansions, preventing us from either
|
|
// suggesting in front of the macro or not at all.
|
|
// cmp!(1, 1);
|
|
}
|
|
|
|
{
|
|
macro_rules! cmp {
|
|
($a:ident, $b:ident) => {
|
|
$a == $b
|
|
}; //~^ WARN unused comparison that must be used
|
|
}
|
|
|
|
let a = 1;
|
|
let b = 1;
|
|
let _ = cmp!(a, b);
|
|
//~^ SUGGESTION let _
|
|
}
|
|
|
|
{
|
|
macro_rules! cmp {
|
|
($a:expr, $b:expr) => {
|
|
$a == $b
|
|
}; //~^ WARN unused comparison that must be used
|
|
}
|
|
|
|
let _ = cmp!(1, 1);
|
|
//~^ SUGGESTION let _
|
|
}
|
|
|
|
{
|
|
macro_rules! cmp {
|
|
($a:tt, $b:tt) => {
|
|
$a.eq(&$b)
|
|
};
|
|
}
|
|
|
|
let _ = cmp!(1, 1);
|
|
//~^ WARN unused return value
|
|
//~| SUGGESTION let _
|
|
}
|
|
}
|