Skip to content

nightly warning: unused ControlFlow that must be used #7736

Description

@BenWiederhake

When compiling with nightly (cargo 1.88.0-nightly 2025-03-26 or newer, probably older as well), we get some compilation warnings:

warning: unused `ControlFlow` that must be used
   --> src/uucore/src/lib/features/format/mod.rs:281:9
    |
281 |         item?.write(&mut writer, &mut args)?;
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: `#[warn(unused_must_use)]` on by default
help: use `let _ = ...` to ignore the resulting value
    |
281 |         let _ = item?.write(&mut writer, &mut args)?;
    |         +++++++

warning: unused `ControlFlow` that must be used
   --> src/uu/echo/src/echo.rs:153:17
    |
153 | /                 match item {
154 | |                     EscapedChar::End => return Ok(()),
155 | |                     c => c.write(&mut *stdout_lock)?,
156 | |                 };
    | |_________________^
    |
    = note: `#[warn(unused_must_use)]` on by default
help: use `let _ = ...` to ignore the resulting value
    |
153 |                 let _ = match item {
    |                 +++++++

It seems that there have been some changes to the inner workings of the compiler: rust-lang/rust#137449

I'm not quite sure how to deal with this, but it seems that this warning will make it's way into stable eventually I guess, so let's "fix" this issue? However, in both cases I don't fully understand why that is even necessary, so I don't trust the compiler-suggested code.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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