1
Fork 0

Tweak span for #[must_use]

Do not point at whole statement, only at the expression (skip pointing at `;`)
This commit is contained in:
Esteban Küber 2022-08-16 07:46:33 -07:00
parent c1a859b25a
commit 50bb7a40e1
24 changed files with 58 additions and 61 deletions

View file

@ -87,17 +87,14 @@ declare_lint_pass!(UnusedResults => [UNUSED_MUST_USE, UNUSED_RESULTS]);
impl<'tcx> LateLintPass<'tcx> for UnusedResults { impl<'tcx> LateLintPass<'tcx> for UnusedResults {
fn check_stmt(&mut self, cx: &LateContext<'_>, s: &hir::Stmt<'_>) { fn check_stmt(&mut self, cx: &LateContext<'_>, s: &hir::Stmt<'_>) {
let expr = match s.kind { let hir::StmtKind::Semi(expr) = s.kind else { return; };
hir::StmtKind::Semi(ref expr) => &**expr,
_ => return,
};
if let hir::ExprKind::Ret(..) = expr.kind { if let hir::ExprKind::Ret(..) = expr.kind {
return; return;
} }
let ty = cx.typeck_results().expr_ty(&expr); let ty = cx.typeck_results().expr_ty(&expr);
let type_permits_lack_of_use = check_must_use_ty(cx, ty, &expr, s.span, "", "", 1); let type_permits_lack_of_use = check_must_use_ty(cx, ty, &expr, expr.span, "", "", 1);
let mut fn_warned = false; let mut fn_warned = false;
let mut op_warned = false; let mut op_warned = false;
@ -119,7 +116,7 @@ impl<'tcx> LateLintPass<'tcx> for UnusedResults {
_ => None, _ => None,
}; };
if let Some(def_id) = maybe_def_id { if let Some(def_id) = maybe_def_id {
fn_warned = check_must_use_def(cx, def_id, s.span, "return value of ", ""); fn_warned = check_must_use_def(cx, def_id, expr.span, "return value of ", "");
} else if type_permits_lack_of_use { } else if type_permits_lack_of_use {
// We don't warn about unused unit or uninhabited types. // We don't warn about unused unit or uninhabited types.
// (See https://github.com/rust-lang/rust/issues/43806 for details.) // (See https://github.com/rust-lang/rust/issues/43806 for details.)

View file

@ -16,7 +16,7 @@ LL | / || match out_ref {
LL | | Variant::A => (), LL | | Variant::A => (),
LL | | Variant::B => (), LL | | Variant::B => (),
LL | | }; LL | | };
| |______^ | |_____^
| |
= note: closures are lazy and do nothing unless called = note: closures are lazy and do nothing unless called
= note: `#[warn(unused_must_use)]` on by default = note: `#[warn(unused_must_use)]` on by default
@ -28,7 +28,7 @@ LL | / || match here.field {
LL | | Variant::A => (), LL | | Variant::A => (),
LL | | Variant::B => (), LL | | Variant::B => (),
LL | | }; LL | | };
| |______^ | |_____^
| |
= note: closures are lazy and do nothing unless called = note: closures are lazy and do nothing unless called

View file

@ -28,7 +28,7 @@ warning: unused `MustUseDeprecated` that must be used
--> $DIR/cfg-attr-multi-true.rs:19:5 --> $DIR/cfg-attr-multi-true.rs:19:5
| |
LL | MustUseDeprecated::new(); LL | MustUseDeprecated::new();
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/cfg-attr-multi-true.rs:7:9 --> $DIR/cfg-attr-multi-true.rs:7:9

View file

@ -4,7 +4,7 @@ warning: unused generator that must be used
LL | / move || { LL | / move || {
LL | | A.test(yield); LL | | A.test(yield);
LL | | }; LL | | };
| |______^ | |_____^
| |
= note: generators are lazy and do nothing unless resumed = note: generators are lazy and do nothing unless resumed
= note: `#[warn(unused_must_use)]` on by default = note: `#[warn(unused_must_use)]` on by default
@ -16,7 +16,7 @@ LL | / static move || {
LL | | yield *y.borrow(); LL | | yield *y.borrow();
LL | | return "Done"; LL | | return "Done";
LL | | }; LL | | };
| |______^ | |_____^
| |
= note: generators are lazy and do nothing unless resumed = note: generators are lazy and do nothing unless resumed

View file

@ -7,7 +7,7 @@ LL | | loop {
LL | | yield LL | | yield
LL | | } LL | | }
LL | | }; LL | | };
| |______^ | |_____^
| |
= note: generators are lazy and do nothing unless resumed = note: generators are lazy and do nothing unless resumed
= note: `#[warn(unused_must_use)]` on by default = note: `#[warn(unused_must_use)]` on by default

View file

@ -8,7 +8,7 @@ LL | | match Enum::A(String::new()) {
... | ... |
LL | | } LL | | }
LL | | }; LL | | };
| |______^ | |_____^
| |
= note: generators are lazy and do nothing unless resumed = note: generators are lazy and do nothing unless resumed
= note: `#[warn(unused_must_use)]` on by default = note: `#[warn(unused_must_use)]` on by default

View file

@ -8,7 +8,7 @@ LL | | yield;
... | ... |
LL | | *bar = 2; LL | | *bar = 2;
LL | | }; LL | | };
| |______^ | |_____^
| |
= note: generators are lazy and do nothing unless resumed = note: generators are lazy and do nothing unless resumed
= note: `#[warn(unused_must_use)]` on by default = note: `#[warn(unused_must_use)]` on by default

View file

@ -8,7 +8,7 @@ LL | | // and it should also find out that `a` is not live.
... | ... |
LL | | let _ = &a; LL | | let _ = &a;
LL | | }; LL | | };
| |__________^ | |_________^
| |
= note: generators are lazy and do nothing unless resumed = note: generators are lazy and do nothing unless resumed
= note: `#[warn(unused_must_use)]` on by default = note: `#[warn(unused_must_use)]` on by default

View file

@ -5,7 +5,7 @@ LL | / || {
LL | | let b = true; LL | | let b = true;
LL | | foo(yield, &b); LL | | foo(yield, &b);
LL | | }; LL | | };
| |______^ | |_____^
| |
= note: generators are lazy and do nothing unless resumed = note: generators are lazy and do nothing unless resumed
= note: `#[warn(unused_must_use)]` on by default = note: `#[warn(unused_must_use)]` on by default

View file

@ -8,7 +8,7 @@ LL | | let _t = box (&x, yield 0, &y);
... | ... |
LL | | } LL | | }
LL | | }; LL | | };
| |______^ | |_____^
| |
= note: generators are lazy and do nothing unless resumed = note: generators are lazy and do nothing unless resumed
= note: `#[warn(unused_must_use)]` on by default = note: `#[warn(unused_must_use)]` on by default

View file

@ -8,7 +8,7 @@ LL | | // See https://github.com/rust-lang/rust/issues/52792
... | ... |
LL | | } LL | | }
LL | | }; LL | | };
| |______^ | |_____^
| |
= note: generators are lazy and do nothing unless resumed = note: generators are lazy and do nothing unless resumed
= note: `#[warn(unused_must_use)]` on by default = note: `#[warn(unused_must_use)]` on by default

View file

@ -5,7 +5,7 @@ LL | / || {
LL | | yield a; LL | | yield a;
LL | | yield b; LL | | yield b;
LL | | }; LL | | };
| |______^ | |_____^
| |
= note: generators are lazy and do nothing unless resumed = note: generators are lazy and do nothing unless resumed
= note: `#[warn(unused_must_use)]` on by default = note: `#[warn(unused_must_use)]` on by default

View file

@ -2,7 +2,7 @@ warning: unused closure that must be used
--> $DIR/issue-1460.rs:6:5 --> $DIR/issue-1460.rs:6:5
| |
LL | {|i: u32| if 1 == i { }}; LL | {|i: u32| if 1 == i { }};
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^
| |
= note: closures are lazy and do nothing unless called = note: closures are lazy and do nothing unless called
= note: `#[warn(unused_must_use)]` on by default = note: `#[warn(unused_must_use)]` on by default

View file

@ -2,7 +2,7 @@ warning: unused closure that must be used
--> $DIR/issue-16256.rs:6:5 --> $DIR/issue-16256.rs:6:5
| |
LL | |c: u8| buf.push(c); LL | |c: u8| buf.push(c);
| ^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^
| |
= note: closures are lazy and do nothing unless called = note: closures are lazy and do nothing unless called
= note: `#[warn(unused_must_use)]` on by default = note: `#[warn(unused_must_use)]` on by default

View file

@ -2,7 +2,7 @@ warning: unused return value of `need_to_use_this_value` that must be used
--> $DIR/fn_must_use.rs:55:5 --> $DIR/fn_must_use.rs:55:5
| |
LL | need_to_use_this_value(); LL | need_to_use_this_value();
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^
| |
= note: it's important = note: it's important
note: the lint level is defined here note: the lint level is defined here
@ -15,13 +15,13 @@ warning: unused return value of `MyStruct::need_to_use_this_method_value` that m
--> $DIR/fn_must_use.rs:60:5 --> $DIR/fn_must_use.rs:60:5
| |
LL | m.need_to_use_this_method_value(); LL | m.need_to_use_this_method_value();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: unused return value of `EvenNature::is_even` that must be used warning: unused return value of `EvenNature::is_even` that must be used
--> $DIR/fn_must_use.rs:61:5 --> $DIR/fn_must_use.rs:61:5
| |
LL | m.is_even(); // trait method! LL | m.is_even(); // trait method!
| ^^^^^^^^^^^^ | ^^^^^^^^^^^
| |
= note: no side effects = note: no side effects
@ -29,19 +29,19 @@ warning: unused return value of `MyStruct::need_to_use_this_associated_function_
--> $DIR/fn_must_use.rs:64:5 --> $DIR/fn_must_use.rs:64:5
| |
LL | MyStruct::need_to_use_this_associated_function_value(); LL | MyStruct::need_to_use_this_associated_function_value();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: unused return value of `std::cmp::PartialEq::eq` that must be used warning: unused return value of `std::cmp::PartialEq::eq` that must be used
--> $DIR/fn_must_use.rs:70:5 --> $DIR/fn_must_use.rs:70:5
| |
LL | 2.eq(&3); LL | 2.eq(&3);
| ^^^^^^^^^ | ^^^^^^^^
warning: unused return value of `std::cmp::PartialEq::eq` that must be used warning: unused return value of `std::cmp::PartialEq::eq` that must be used
--> $DIR/fn_must_use.rs:71:5 --> $DIR/fn_must_use.rs:71:5
| |
LL | m.eq(&n); LL | m.eq(&n);
| ^^^^^^^^^ | ^^^^^^^^
warning: unused comparison that must be used warning: unused comparison that must be used
--> $DIR/fn_must_use.rs:74:5 --> $DIR/fn_must_use.rs:74:5

View file

@ -2,7 +2,7 @@ warning: unused return value of `Box::<T>::from_raw` that must be used
--> $DIR/must-use-box-from-raw.rs:8:5 --> $DIR/must-use-box-from-raw.rs:8:5
| |
LL | Box::from_raw(ptr); LL | Box::from_raw(ptr);
| ^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^
| |
= note: call `drop(from_raw(ptr))` if you intend to drop the `Box` = note: call `drop(from_raw(ptr))` if you intend to drop the `Box`
note: the lint level is defined here note: the lint level is defined here

View file

@ -2,7 +2,7 @@ error: unused array of `S` that must be used
--> $DIR/must_use-array.rs:39:5 --> $DIR/must_use-array.rs:39:5
| |
LL | singleton(); LL | singleton();
| ^^^^^^^^^^^^ | ^^^^^^^^^^^
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/must_use-array.rs:1:9 --> $DIR/must_use-array.rs:1:9
@ -14,7 +14,7 @@ error: unused array of `S` that must be used
--> $DIR/must_use-array.rs:40:5 --> $DIR/must_use-array.rs:40:5
| |
LL | many(); LL | many();
| ^^^^^^^ | ^^^^^^
error: unused array of `S` in tuple element 0 that must be used error: unused array of `S` in tuple element 0 that must be used
--> $DIR/must_use-array.rs:41:6 --> $DIR/must_use-array.rs:41:6
@ -26,7 +26,7 @@ error: unused array of implementers of `T` that must be used
--> $DIR/must_use-array.rs:42:5 --> $DIR/must_use-array.rs:42:5
| |
LL | array_of_impl_trait(); LL | array_of_impl_trait();
| ^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^
error: unused array of boxed `T` trait objects in tuple element 1 that must be used error: unused array of boxed `T` trait objects in tuple element 1 that must be used
--> $DIR/must_use-array.rs:43:5 --> $DIR/must_use-array.rs:43:5
@ -38,7 +38,7 @@ error: unused array of arrays of arrays of `S` that must be used
--> $DIR/must_use-array.rs:45:5 --> $DIR/must_use-array.rs:45:5
| |
LL | array_of_arrays_of_arrays(); LL | array_of_arrays_of_arrays();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 6 previous errors error: aborting due to 6 previous errors

View file

@ -2,7 +2,7 @@ error: unused implementer of `Iterator` that must be used
--> $DIR/must_use-in-stdlib-traits.rs:42:4 --> $DIR/must_use-in-stdlib-traits.rs:42:4
| |
LL | iterator(); LL | iterator();
| ^^^^^^^^^^^ | ^^^^^^^^^^
| |
= note: iterators are lazy and do nothing unless consumed = note: iterators are lazy and do nothing unless consumed
note: the lint level is defined here note: the lint level is defined here
@ -15,7 +15,7 @@ error: unused implementer of `Future` that must be used
--> $DIR/must_use-in-stdlib-traits.rs:43:4 --> $DIR/must_use-in-stdlib-traits.rs:43:4
| |
LL | future(); LL | future();
| ^^^^^^^^^ | ^^^^^^^^
| |
= note: futures do nothing unless you `.await` or poll them = note: futures do nothing unless you `.await` or poll them
@ -23,7 +23,7 @@ error: unused implementer of `FnOnce` that must be used
--> $DIR/must_use-in-stdlib-traits.rs:44:4 --> $DIR/must_use-in-stdlib-traits.rs:44:4
| |
LL | square_fn_once(); LL | square_fn_once();
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^
| |
= note: closures are lazy and do nothing unless called = note: closures are lazy and do nothing unless called
@ -31,7 +31,7 @@ error: unused implementer of `FnMut` that must be used
--> $DIR/must_use-in-stdlib-traits.rs:45:4 --> $DIR/must_use-in-stdlib-traits.rs:45:4
| |
LL | square_fn_mut(); LL | square_fn_mut();
| ^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^
| |
= note: closures are lazy and do nothing unless called = note: closures are lazy and do nothing unless called
@ -39,7 +39,7 @@ error: unused implementer of `Fn` that must be used
--> $DIR/must_use-in-stdlib-traits.rs:46:4 --> $DIR/must_use-in-stdlib-traits.rs:46:4
| |
LL | square_fn(); LL | square_fn();
| ^^^^^^^^^^^^ | ^^^^^^^^^^^
| |
= note: closures are lazy and do nothing unless called = note: closures are lazy and do nothing unless called

View file

@ -2,7 +2,7 @@ error: unused implementer of `Critical` that must be used
--> $DIR/must_use-trait.rs:33:5 --> $DIR/must_use-trait.rs:33:5
| |
LL | get_critical(); LL | get_critical();
| ^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/must_use-trait.rs:1:9 --> $DIR/must_use-trait.rs:1:9
@ -14,13 +14,13 @@ error: unused boxed `Critical` trait object that must be used
--> $DIR/must_use-trait.rs:34:5 --> $DIR/must_use-trait.rs:34:5
| |
LL | get_boxed_critical(); LL | get_boxed_critical();
| ^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^
error: unused boxed boxed `Critical` trait object that must be used error: unused boxed boxed `Critical` trait object that must be used
--> $DIR/must_use-trait.rs:35:5 --> $DIR/must_use-trait.rs:35:5
| |
LL | get_nested_boxed_critical(); LL | get_nested_boxed_critical();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: unused boxed `Critical` trait object in tuple element 1 that must be used error: unused boxed `Critical` trait object in tuple element 1 that must be used
--> $DIR/must_use-trait.rs:37:5 --> $DIR/must_use-trait.rs:37:5

View file

@ -2,7 +2,7 @@ error: unused return value of `foo` that must be used
--> $DIR/must_use-unit.rs:13:5 --> $DIR/must_use-unit.rs:13:5
| |
LL | foo(); LL | foo();
| ^^^^^^ | ^^^^^
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/must_use-unit.rs:2:9 --> $DIR/must_use-unit.rs:2:9
@ -14,7 +14,7 @@ error: unused return value of `bar` that must be used
--> $DIR/must_use-unit.rs:15:5 --> $DIR/must_use-unit.rs:15:5
| |
LL | bar(); LL | bar();
| ^^^^^^ | ^^^^^
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View file

@ -4,7 +4,7 @@ error: unused closure that must be used
LL | / || { LL | / || {
LL | | println!("Hello!"); LL | | println!("Hello!");
LL | | }; LL | | };
| |______^ | |_____^
| |
= note: closures are lazy and do nothing unless called = note: closures are lazy and do nothing unless called
note: the lint level is defined here note: the lint level is defined here
@ -17,7 +17,7 @@ error: unused implementer of `Future` that must be used
--> $DIR/unused-closure.rs:13:5 --> $DIR/unused-closure.rs:13:5
| |
LL | async {}; LL | async {};
| ^^^^^^^^^ | ^^^^^^^^
| |
= note: futures do nothing unless you `.await` or poll them = note: futures do nothing unless you `.await` or poll them
@ -25,7 +25,7 @@ error: unused closure that must be used
--> $DIR/unused-closure.rs:14:5 --> $DIR/unused-closure.rs:14:5
| |
LL | || async {}; LL | || async {};
| ^^^^^^^^^^^^ | ^^^^^^^^^^^
| |
= note: closures are lazy and do nothing unless called = note: closures are lazy and do nothing unless called
@ -33,7 +33,7 @@ error: unused closure that must be used
--> $DIR/unused-closure.rs:15:5 --> $DIR/unused-closure.rs:15:5
| |
LL | async || {}; LL | async || {};
| ^^^^^^^^^^^^ | ^^^^^^^^^^^
| |
= note: closures are lazy and do nothing unless called = note: closures are lazy and do nothing unless called
@ -41,7 +41,7 @@ error: unused array of boxed arrays of closures that must be used
--> $DIR/unused-closure.rs:18:5 --> $DIR/unused-closure.rs:18:5
| |
LL | [Box::new([|| {}; 10]); 1]; LL | [Box::new([|| {}; 10]); 1];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
= note: closures are lazy and do nothing unless called = note: closures are lazy and do nothing unless called
@ -49,7 +49,7 @@ error: unused closure that must be used
--> $DIR/unused-closure.rs:20:5 --> $DIR/unused-closure.rs:20:5
| |
LL | vec![|| "a"].pop().unwrap(); LL | vec![|| "a"].pop().unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
= note: closures are lazy and do nothing unless called = note: closures are lazy and do nothing unless called
@ -57,7 +57,7 @@ error: unused closure that must be used
--> $DIR/unused-closure.rs:23:9 --> $DIR/unused-closure.rs:23:9
| |
LL | || true; LL | || true;
| ^^^^^^^^ | ^^^^^^^
| |
= note: closures are lazy and do nothing unless called = note: closures are lazy and do nothing unless called

View file

@ -2,7 +2,7 @@ error: unused `MustUse` that must be used
--> $DIR/unused-result.rs:21:5 --> $DIR/unused-result.rs:21:5
| |
LL | foo::<MustUse>(); LL | foo::<MustUse>();
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/unused-result.rs:2:25 --> $DIR/unused-result.rs:2:25
@ -14,7 +14,7 @@ error: unused `MustUseMsg` that must be used
--> $DIR/unused-result.rs:22:5 --> $DIR/unused-result.rs:22:5
| |
LL | foo::<MustUseMsg>(); LL | foo::<MustUseMsg>();
| ^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^
| |
= note: some message = note: some message
@ -34,13 +34,13 @@ error: unused `MustUse` that must be used
--> $DIR/unused-result.rs:35:5 --> $DIR/unused-result.rs:35:5
| |
LL | foo::<MustUse>(); LL | foo::<MustUse>();
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^
error: unused `MustUseMsg` that must be used error: unused `MustUseMsg` that must be used
--> $DIR/unused-result.rs:36:5 --> $DIR/unused-result.rs:36:5
| |
LL | foo::<MustUseMsg>(); LL | foo::<MustUseMsg>();
| ^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^
| |
= note: some message = note: some message

View file

@ -139,7 +139,7 @@ error: unused `X` that must be used
--> $DIR/unused_attributes-must_use.rs:103:5 --> $DIR/unused_attributes-must_use.rs:103:5
| |
LL | X; LL | X;
| ^^ | ^
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/unused_attributes-must_use.rs:2:28 --> $DIR/unused_attributes-must_use.rs:2:28
@ -151,37 +151,37 @@ error: unused `Y` that must be used
--> $DIR/unused_attributes-must_use.rs:104:5 --> $DIR/unused_attributes-must_use.rs:104:5
| |
LL | Y::Z; LL | Y::Z;
| ^^^^^ | ^^^^
error: unused `U` that must be used error: unused `U` that must be used
--> $DIR/unused_attributes-must_use.rs:105:5 --> $DIR/unused_attributes-must_use.rs:105:5
| |
LL | U { unit: () }; LL | U { unit: () };
| ^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^
error: unused return value of `U::method` that must be used error: unused return value of `U::method` that must be used
--> $DIR/unused_attributes-must_use.rs:106:5 --> $DIR/unused_attributes-must_use.rs:106:5
| |
LL | U::method(); LL | U::method();
| ^^^^^^^^^^^^ | ^^^^^^^^^^^
error: unused return value of `foo` that must be used error: unused return value of `foo` that must be used
--> $DIR/unused_attributes-must_use.rs:107:5 --> $DIR/unused_attributes-must_use.rs:107:5
| |
LL | foo(); LL | foo();
| ^^^^^^ | ^^^^^
error: unused return value of `foreign_foo` that must be used error: unused return value of `foreign_foo` that must be used
--> $DIR/unused_attributes-must_use.rs:110:9 --> $DIR/unused_attributes-must_use.rs:110:9
| |
LL | foreign_foo(); LL | foreign_foo();
| ^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
error: unused return value of `Use::get_four` that must be used error: unused return value of `Use::get_four` that must be used
--> $DIR/unused_attributes-must_use.rs:118:5 --> $DIR/unused_attributes-must_use.rs:118:5
| |
LL | ().get_four(); LL | ().get_four();
| ^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
error: aborting due to 28 previous errors error: aborting due to 28 previous errors

View file

@ -2,7 +2,7 @@ warning: unused generator that must be used
--> $DIR/issue-48623-generator.rs:15:5 --> $DIR/issue-48623-generator.rs:15:5
| |
LL | move || { d; yield; &mut *r }; LL | move || { d; yield; &mut *r };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
= note: generators are lazy and do nothing unless resumed = note: generators are lazy and do nothing unless resumed
= note: `#[warn(unused_must_use)]` on by default = note: `#[warn(unused_must_use)]` on by default