Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

let_underscore_untyped fails to consider configured msrv #10410

Closed
dtolnay opened this issue Feb 27, 2023 · 10 comments · Fixed by #10702
Closed

let_underscore_untyped fails to consider configured msrv #10410

dtolnay opened this issue Feb 27, 2023 · 10 comments · Fixed by #10702
Assignees
Labels
C-bug Category: Clippy is not doing the correct thing I-suggestion-causes-error Issue: The suggestions provided by this Lint cause an ICE/error when applied

Comments

@dtolnay
Copy link
Member

dtolnay commented Feb 27, 2023

Summary

Clippy's let_underscore_untyped lint triggers on code that is 100% good and idiomatic in projects that target 1.58 or older.

Lint Name

let_underscore_untyped

Reproducer

// src/main.rs

#![deny(clippy::pedantic)]

fn f() -> Result<u8, ()> {
    Err(())
}

fn main() {
    let _ = f();
}
# .clippy.toml

msrv = "1.58.0"
$ cargo clippy

error: non-binding `let` without a type annotation
 --> src/main.rs:8:5
  |
8 |     let _ = f();
  |     ^^^^^^^^^^^^
  |
  = help: consider adding a type annotation or removing the `let` keyword
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
note: the lint level is defined here
 --> src/main.rs:1:9
  |
1 | #![deny(clippy::pedantic)]
  |         ^^^^^^^^^^^^^^^^
  = note: `#[deny(clippy::let_underscore_untyped)]` implied by `#[deny(clippy::pedantic)]`

Clippy's suggested code does not compile.

error[E0658]: destructuring assignments are unstable
 --> src/main.rs:8:5
  |
8 |     _ = f();
  |     ^
  |
  = note: see issue #71126 <https://github.com/rust-lang/rust/issues/71126> for more information

error[E0658]: destructuring assignments are unstable
 --> src/main.rs:8:7
  |
8 |     _ = f();
  |     - ^
  |     |
  |     cannot assign to this expression
  |
  = note: see issue #71126 <https://github.com/rust-lang/rust/issues/71126> for more information

Version

rustc 1.69.0-nightly (d962ea578 2023-02-26)
binary: rustc
commit-hash: d962ea57899d64dc8a57040142c6b498a57c8064
commit-date: 2023-02-26
host: aarch64-unknown-linux-gnu
release: 1.69.0-nightly
LLVM version: 15.0.7

Additional Labels

@rustbot label +I-suggestion-causes-error

@dtolnay dtolnay added C-bug Category: Clippy is not doing the correct thing I-false-positive Issue: The lint was triggered on code it shouldn't have labels Feb 27, 2023
@rustbot rustbot added the I-suggestion-causes-error Issue: The suggestions provided by this Lint cause an ICE/error when applied label Feb 27, 2023
@dtolnay
Copy link
Member Author

dtolnay commented Feb 27, 2023

Mentioning @JirkaVebr @llogiq since this lint is from #10356.

dtolnay added a commit to dtolnay/trybuild that referenced this issue Feb 27, 2023
rust-lang/rust-clippy#10410

    error: non-binding `let` without a type annotation
      --> src/term.rs:70:9
       |
    70 |         let _ = self.stream.reset();
       |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       |
       = help: consider adding a type annotation or removing the `let` keyword
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
       = note: `-D clippy::let-underscore-untyped` implied by `-D clippy::pedantic`

    error: non-binding `let` without a type annotation
      --> src/term.rs:85:17
       |
    85 |                 let _ = self.stream.set_color(&self.spec);
       |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       |
       = help: consider adding a type annotation or removing the `let` keyword
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped

    error: non-binding `let` without a type annotation
      --> src/cargo.rs:70:9
       |
    70 |         let _ = fs::copy(workspace_cargo_lock, path!(project.dir / "Cargo.lock"));
       |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       |
       = help: consider adding a type annotation or removing the `let` keyword
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped

    error: non-binding `let` without a type annotation
      --> src/cargo.rs:72:9
       |
    72 |         let _ = cargo(project).arg("generate-lockfile").status();
       |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       |
       = help: consider adding a type annotation or removing the `let` keyword
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped

    error: non-binding `let` without a type annotation
       --> src/cargo.rs:102:5
        |
    102 | /     let _ = cargo(project)
    103 | |         .arg("clean")
    104 | |         .arg("--package")
    105 | |         .arg(&project.name)
    ...   |
    108 | |         .stderr(Stdio::null())
    109 | |         .status();
        | |__________________^
        |
        = help: consider adding a type annotation or removing the `let` keyword
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped

    error: non-binding `let` without a type annotation
       --> src/cargo.rs:125:5
        |
    125 | /     let _ = cargo(project)
    126 | |         .arg("clean")
    127 | |         .arg("--package")
    128 | |         .arg(&project.name)
    ...   |
    131 | |         .stderr(Stdio::null())
    132 | |         .status();
        | |__________________^
        |
        = help: consider adding a type annotation or removing the `let` keyword
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped

    error: non-binding `let` without a type annotation
       --> src/term.rs:34:9
        |
    34  |         let _ = std::write!($crate::term::lock(), $($args)*);
        |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
       ::: src/cargo.rs:170:9
        |
    170 |         print!("{}", String::from_utf8_lossy(&output.stderr));
        |         ----------------------------------------------------- in this macro invocation
        |
        = help: consider adding a type annotation or removing the `let` keyword
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
        = note: this error originates in the macro `print` (in Nightly builds, run with -Z macro-backtrace for more info)

    error: non-binding `let` without a type annotation
      --> src/diff.rs:77:13
       |
    77 |             let _ = Render::Common;
       |             ^^^^^^^^^^^^^^^^^^^^^^^
       |
       = help: consider adding a type annotation or removing the `let` keyword
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped

    error: non-binding `let` without a type annotation
      --> src/diff.rs:78:13
       |
    78 |             let _ = Render::Unique;
       |             ^^^^^^^^^^^^^^^^^^^^^^^
       |
       = help: consider adding a type annotation or removing the `let` keyword
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped

    error: non-binding `let` without a type annotation
      --> src/flock.rs:87:17
       |
    87 |                 let _ = fs::remove_file(path);
       |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       |
       = help: consider adding a type annotation or removing the `let` keyword
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped

    error: non-binding `let` without a type annotation
      --> src/term.rs:34:9
       |
    34 |         let _ = std::write!($crate::term::lock(), $($args)*);
       |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       |
      ::: src/message.rs:22:5
       |
    22 |     print!("ERROR");
       |     --------------- in this macro invocation
       |
       = help: consider adding a type annotation or removing the `let` keyword
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
       = note: this error originates in the macro `print` (in Nightly builds, run with -Z macro-backtrace for more info)

    error: non-binding `let` without a type annotation
      --> src/term.rs:42:9
       |
    42 |         let _ = std::writeln!($crate::term::lock(), $($args)*);
       |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       |
      ::: src/message.rs:24:5
       |
    24 |     println!(": {}", err);
       |     --------------------- in this macro invocation
       |
       = help: consider adding a type annotation or removing the `let` keyword
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
       = note: this error originates in the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)

    error: non-binding `let` without a type annotation
      --> src/term.rs:42:9
       |
    42 |         let _ = std::writeln!($crate::term::lock(), $($args)*);
       |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       |
      ::: src/message.rs:25:5
       |
    25 |     println!();
       |     ---------- in this macro invocation
       |
       = help: consider adding a type annotation or removing the `let` keyword
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
       = note: this error originates in the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)

    error: non-binding `let` without a type annotation
      --> src/term.rs:42:9
       |
    42 |         let _ = std::writeln!($crate::term::lock(), $($args)*);
       |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       |
      ::: src/message.rs:34:5
       |
    34 |     println!("error");
       |     ----------------- in this macro invocation
       |
       = help: consider adding a type annotation or removing the `let` keyword
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
       = note: this error originates in the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)

    error: non-binding `let` without a type annotation
      --> src/term.rs:42:9
       |
    42 |         let _ = std::writeln!($crate::term::lock(), $($args)*);
       |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       |
      ::: src/message.rs:36:5
       |
    36 |     println!("{}", err);
       |     ------------------- in this macro invocation
       |
       = help: consider adding a type annotation or removing the `let` keyword
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
       = note: this error originates in the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)

    error: non-binding `let` without a type annotation
      --> src/term.rs:42:9
       |
    42 |         let _ = std::writeln!($crate::term::lock(), $($args)*);
       |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       |
      ::: src/message.rs:38:5
       |
    38 |     println!();
       |     ---------- in this macro invocation
       |
       = help: consider adding a type annotation or removing the `let` keyword
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
       = note: this error originates in the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)

    error: non-binding `let` without a type annotation
      --> src/term.rs:42:9
       |
    42 |         let _ = std::writeln!($crate::term::lock(), $($args)*);
       |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       |
      ::: src/message.rs:43:5
       |
    43 |     println!("There are no trybuild tests enabled yet.");
       |     ---------------------------------------------------- in this macro invocation
       |
       = help: consider adding a type annotation or removing the `let` keyword
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
       = note: this error originates in the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)

    error: non-binding `let` without a type annotation
      --> src/term.rs:42:9
       |
    42 |         let _ = std::writeln!($crate::term::lock(), $($args)*);
       |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       |
      ::: src/message.rs:49:5
       |
    49 |     println!("ok");
       |     -------------- in this macro invocation
       |
       = help: consider adding a type annotation or removing the `let` keyword
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
       = note: this error originates in the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)

    error: non-binding `let` without a type annotation
      --> src/term.rs:34:9
       |
    34 |         let _ = std::write!($crate::term::lock(), $($args)*);
       |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       |
      ::: src/message.rs:56:5
       |
    56 |     print!("test ");
       |     --------------- in this macro invocation
       |
       = help: consider adding a type annotation or removing the `let` keyword
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
       = note: this error originates in the macro `print` (in Nightly builds, run with -Z macro-backtrace for more info)

    error: non-binding `let` without a type annotation
      --> src/term.rs:34:9
       |
    34 |         let _ = std::write!($crate::term::lock(), $($args)*);
       |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       |
      ::: src/message.rs:58:5
       |
    58 |     print!("{}", display_name);
       |     -------------------------- in this macro invocation
       |
       = help: consider adding a type annotation or removing the `let` keyword
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
       = note: this error originates in the macro `print` (in Nightly builds, run with -Z macro-backtrace for more info)

    error: non-binding `let` without a type annotation
      --> src/term.rs:34:9
       |
    34 |         let _ = std::write!($crate::term::lock(), $($args)*);
       |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       |
      ::: src/message.rs:63:31
       |
    63 |             Expected::Pass => print!(" [should pass]"),
       |                               ------------------------ in this macro invocation
       |
       = help: consider adding a type annotation or removing the `let` keyword
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
       = note: this error originates in the macro `print` (in Nightly builds, run with -Z macro-backtrace for more info)

    error: non-binding `let` without a type annotation
      --> src/term.rs:34:9
       |
    34 |         let _ = std::write!($crate::term::lock(), $($args)*);
       |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       |
      ::: src/message.rs:64:38
       |
    64 |             Expected::CompileFail => print!(" [should fail to compile]"),
       |                                      ----------------------------------- in this macro invocation
       |
       = help: consider adding a type annotation or removing the `let` keyword
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
       = note: this error originates in the macro `print` (in Nightly builds, run with -Z macro-backtrace for more info)

    error: non-binding `let` without a type annotation
      --> src/term.rs:34:9
       |
    34 |         let _ = std::write!($crate::term::lock(), $($args)*);
       |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       |
      ::: src/message.rs:68:5
       |
    68 |     print!(" ... ");
       |     --------------- in this macro invocation
       |
       = help: consider adding a type annotation or removing the `let` keyword
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
       = note: this error originates in the macro `print` (in Nightly builds, run with -Z macro-backtrace for more info)

    error: non-binding `let` without a type annotation
      --> src/term.rs:42:9
       |
    42 |         let _ = std::writeln!($crate::term::lock(), $($args)*);
       |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       |
      ::: src/message.rs:73:5
       |
    73 |     println!("error");
       |     ----------------- in this macro invocation
       |
       = help: consider adding a type annotation or removing the `let` keyword
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
       = note: this error originates in the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)

    error: non-binding `let` without a type annotation
      --> src/term.rs:42:9
       |
    42 |         let _ = std::writeln!($crate::term::lock(), $($args)*);
       |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       |
      ::: src/message.rs:75:5
       |
    75 |     println!();
       |     ---------- in this macro invocation
       |
       = help: consider adding a type annotation or removing the `let` keyword
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
       = note: this error originates in the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)

    error: non-binding `let` without a type annotation
      --> src/term.rs:42:9
       |
    42 |         let _ = std::writeln!($crate::term::lock(), $($args)*);
       |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       |
      ::: src/message.rs:80:5
       |
    80 |     println!("error");
       |     ----------------- in this macro invocation
       |
       = help: consider adding a type annotation or removing the `let` keyword
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
       = note: this error originates in the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)

    error: non-binding `let` without a type annotation
      --> src/term.rs:42:9
       |
    42 |         let _ = std::writeln!($crate::term::lock(), $($args)*);
       |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       |
      ::: src/message.rs:82:5
       |
    82 |     println!("Expected test case to fail to compile, but it succeeded.");
       |     -------------------------------------------------------------------- in this macro invocation
       |
       = help: consider adding a type annotation or removing the `let` keyword
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
       = note: this error originates in the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)

    error: non-binding `let` without a type annotation
      --> src/term.rs:42:9
       |
    42 |         let _ = std::writeln!($crate::term::lock(), $($args)*);
       |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       |
      ::: src/message.rs:84:5
       |
    84 |     println!();
       |     ---------- in this macro invocation
       |
       = help: consider adding a type annotation or removing the `let` keyword
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
       = note: this error originates in the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)

    error: non-binding `let` without a type annotation
      --> src/term.rs:42:9
       |
    42 |         let _ = std::writeln!($crate::term::lock(), $($args)*);
       |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       |
      ::: src/message.rs:92:5
       |
    92 |     println!("wip");
       |     --------------- in this macro invocation
       |
       = help: consider adding a type annotation or removing the `let` keyword
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
       = note: this error originates in the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)

    error: non-binding `let` without a type annotation
      --> src/term.rs:42:9
       |
    42 |         let _ = std::writeln!($crate::term::lock(), $($args)*);
       |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       |
      ::: src/message.rs:93:5
       |
    93 |     println!();
       |     ---------- in this macro invocation
       |
       = help: consider adding a type annotation or removing the `let` keyword
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
       = note: this error originates in the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)

    error: non-binding `let` without a type annotation
      --> src/term.rs:34:9
       |
    34 |         let _ = std::write!($crate::term::lock(), $($args)*);
       |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       |
      ::: src/message.rs:94:5
       |
    94 |     print!("NOTE");
       |     -------------- in this macro invocation
       |
       = help: consider adding a type annotation or removing the `let` keyword
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
       = note: this error originates in the macro `print` (in Nightly builds, run with -Z macro-backtrace for more info)

    error: non-binding `let` without a type annotation
      --> src/term.rs:42:9
       |
    42 |         let _ = std::writeln!($crate::term::lock(), $($args)*);
       |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       |
      ::: src/message.rs:96:5
       |
    96 |     println!(": writing the following output to `{}`.", wip_path);
       |     ------------------------------------------------------------- in this macro invocation
       |
       = help: consider adding a type annotation or removing the `let` keyword
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
       = note: this error originates in the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)

    error: non-binding `let` without a type annotation
       --> src/term.rs:42:9
        |
    42  |           let _ = std::writeln!($crate::term::lock(), $($args)*);
        |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
       ::: src/message.rs:97:5
        |
    97  | /     println!(
    98  | |         "Move this file to `{}` to accept it as correct.",
    99  | |         stderr_path,
    100 | |     );
        | |_____- in this macro invocation
        |
        = help: consider adding a type annotation or removing the `let` keyword
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
        = note: this error originates in the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)

    error: non-binding `let` without a type annotation
       --> src/term.rs:42:9
        |
    42  |         let _ = std::writeln!($crate::term::lock(), $($args)*);
        |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
       ::: src/message.rs:102:5
        |
    102 |     println!();
        |     ---------- in this macro invocation
        |
        = help: consider adding a type annotation or removing the `let` keyword
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
        = note: this error originates in the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)

    error: non-binding `let` without a type annotation
       --> src/term.rs:42:9
        |
    42  |         let _ = std::writeln!($crate::term::lock(), $($args)*);
        |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
       ::: src/message.rs:109:5
        |
    109 |     println!("wip");
        |     --------------- in this macro invocation
        |
        = help: consider adding a type annotation or removing the `let` keyword
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
        = note: this error originates in the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)

    error: non-binding `let` without a type annotation
       --> src/term.rs:42:9
        |
    42  |         let _ = std::writeln!($crate::term::lock(), $($args)*);
        |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
       ::: src/message.rs:110:5
        |
    110 |     println!();
        |     ---------- in this macro invocation
        |
        = help: consider adding a type annotation or removing the `let` keyword
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
        = note: this error originates in the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)

    error: non-binding `let` without a type annotation
       --> src/term.rs:34:9
        |
    34  |         let _ = std::write!($crate::term::lock(), $($args)*);
        |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
       ::: src/message.rs:111:5
        |
    111 |     print!("NOTE");
        |     -------------- in this macro invocation
        |
        = help: consider adding a type annotation or removing the `let` keyword
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
        = note: this error originates in the macro `print` (in Nightly builds, run with -Z macro-backtrace for more info)

    error: non-binding `let` without a type annotation
       --> src/term.rs:42:9
        |
    42  |         let _ = std::writeln!($crate::term::lock(), $($args)*);
        |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
       ::: src/message.rs:113:5
        |
    113 |     println!(": writing the following output to `{}`.", stderr_path);
        |     ---------------------------------------------------------------- in this macro invocation
        |
        = help: consider adding a type annotation or removing the `let` keyword
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
        = note: this error originates in the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)

    error: non-binding `let` without a type annotation
       --> src/term.rs:42:9
        |
    42  |         let _ = std::writeln!($crate::term::lock(), $($args)*);
        |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
       ::: src/message.rs:115:5
        |
    115 |     println!();
        |     ---------- in this macro invocation
        |
        = help: consider adding a type annotation or removing the `let` keyword
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
        = note: this error originates in the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)

    error: non-binding `let` without a type annotation
       --> src/term.rs:42:9
        |
    42  |         let _ = std::writeln!($crate::term::lock(), $($args)*);
        |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
       ::: src/message.rs:120:5
        |
    120 |     println!("mismatch");
        |     -------------------- in this macro invocation
        |
        = help: consider adding a type annotation or removing the `let` keyword
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
        = note: this error originates in the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)

    error: non-binding `let` without a type annotation
       --> src/term.rs:42:9
        |
    42  |         let _ = std::writeln!($crate::term::lock(), $($args)*);
        |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
       ::: src/message.rs:122:5
        |
    122 |     println!();
        |     ---------- in this macro invocation
        |
        = help: consider adding a type annotation or removing the `let` keyword
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
        = note: this error originates in the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)

    error: non-binding `let` without a type annotation
       --> src/term.rs:42:9
        |
    42  |         let _ = std::writeln!($crate::term::lock(), $($args)*);
        |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
       ::: src/message.rs:130:5
        |
    130 |     println!("EXPECTED:");
        |     --------------------- in this macro invocation
        |
        = help: consider adding a type annotation or removing the `let` keyword
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
        = note: this error originates in the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)

    error: non-binding `let` without a type annotation
       --> src/term.rs:42:9
        |
    42  |         let _ = std::writeln!($crate::term::lock(), $($args)*);
        |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
       ::: src/message.rs:132:5
        |
    132 |     println!();
        |     ---------- in this macro invocation
        |
        = help: consider adding a type annotation or removing the `let` keyword
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
        = note: this error originates in the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)

    error: non-binding `let` without a type annotation
       --> src/term.rs:42:9
        |
    42  |         let _ = std::writeln!($crate::term::lock(), $($args)*);
        |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
       ::: src/message.rs:134:5
        |
    134 |     println!("ACTUAL OUTPUT:");
        |     -------------------------- in this macro invocation
        |
        = help: consider adding a type annotation or removing the `let` keyword
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
        = note: this error originates in the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)

    error: non-binding `let` without a type annotation
       --> src/term.rs:34:9
        |
    34  |         let _ = std::write!($crate::term::lock(), $($args)*);
        |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
       ::: src/message.rs:136:5
        |
    136 |     print!("note: If the ");
        |     ----------------------- in this macro invocation
        |
        = help: consider adding a type annotation or removing the `let` keyword
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
        = note: this error originates in the macro `print` (in Nightly builds, run with -Z macro-backtrace for more info)

    error: non-binding `let` without a type annotation
       --> src/term.rs:34:9
        |
    34  |         let _ = std::write!($crate::term::lock(), $($args)*);
        |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
       ::: src/message.rs:138:5
        |
    138 |     print!("actual output");
        |     ----------------------- in this macro invocation
        |
        = help: consider adding a type annotation or removing the `let` keyword
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
        = note: this error originates in the macro `print` (in Nightly builds, run with -Z macro-backtrace for more info)

    error: non-binding `let` without a type annotation
       --> src/term.rs:42:9
        |
    42  |         let _ = std::writeln!($crate::term::lock(), $($args)*);
        |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
       ::: src/message.rs:140:5
        |
    140 |     println!(" is the correct output you can bless it by rerunning");
        |     ---------------------------------------------------------------- in this macro invocation
        |
        = help: consider adding a type annotation or removing the `let` keyword
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
        = note: this error originates in the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)

    error: non-binding `let` without a type annotation
       --> src/term.rs:42:9
        |
    42  |         let _ = std::writeln!($crate::term::lock(), $($args)*);
        |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
       ::: src/message.rs:141:5
        |
    141 |     println!("      your test with the environment variable TRYBUILD=overwrite");
        |     ---------------------------------------------------------------------------- in this macro invocation
        |
        = help: consider adding a type annotation or removing the `let` keyword
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
        = note: this error originates in the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)

    error: non-binding `let` without a type annotation
       --> src/term.rs:42:9
        |
    42  |         let _ = std::writeln!($crate::term::lock(), $($args)*);
        |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
       ::: src/message.rs:142:5
        |
    142 |     println!();
        |     ---------- in this macro invocation
        |
        = help: consider adding a type annotation or removing the `let` keyword
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
        = note: this error originates in the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)

    error: non-binding `let` without a type annotation
       --> src/term.rs:42:9
        |
    42  |         let _ = std::writeln!($crate::term::lock(), $($args)*);
        |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
       ::: src/message.rs:154:13
        |
    154 |             println!();
        |             ---------- in this macro invocation
        |
        = help: consider adding a type annotation or removing the `let` keyword
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
        = note: this error originates in the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)

    error: non-binding `let` without a type annotation
       --> src/term.rs:42:9
        |
    42  |         let _ = std::writeln!($crate::term::lock(), $($args)*);
        |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
       ::: src/message.rs:158:9
        |
    158 |         println!("error");
        |         ----------------- in this macro invocation
        |
        = help: consider adding a type annotation or removing the `let` keyword
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
        = note: this error originates in the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)

    error: non-binding `let` without a type annotation
       --> src/term.rs:42:9
        |
    42  |         let _ = std::writeln!($crate::term::lock(), $($args)*);
        |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
       ::: src/message.rs:161:13
        |
    161 |             println!("Test case failed at runtime.");
        |             ---------------------------------------- in this macro invocation
        |
        = help: consider adding a type annotation or removing the `let` keyword
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
        = note: this error originates in the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)

    error: non-binding `let` without a type annotation
       --> src/term.rs:42:9
        |
    42  |         let _ = std::writeln!($crate::term::lock(), $($args)*);
        |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
       ::: src/message.rs:163:13
        |
    163 | ...   println!("Execution of the test case was unsuccessful but there was no output.");
        |       -------------------------------------------------------------------------------- in this macro invocation
        |
        = help: consider adding a type annotation or removing the `let` keyword
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
        = note: this error originates in the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)

    error: non-binding `let` without a type annotation
       --> src/term.rs:42:9
        |
    42  |         let _ = std::writeln!($crate::term::lock(), $($args)*);
        |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
       ::: src/message.rs:166:9
        |
    166 |         println!();
        |         ---------- in this macro invocation
        |
        = help: consider adding a type annotation or removing the `let` keyword
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
        = note: this error originates in the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)

    error: non-binding `let` without a type annotation
       --> src/term.rs:42:9
        |
    42  |         let _ = std::writeln!($crate::term::lock(), $($args)*);
        |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
       ::: src/message.rs:176:13
        |
    176 |             println!("{}:", name);
        |             --------------------- in this macro invocation
        |
        = help: consider adding a type annotation or removing the `let` keyword
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
        = note: this error originates in the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)

    error: non-binding `let` without a type annotation
       --> src/term.rs:42:9
        |
    42  |         let _ = std::writeln!($crate::term::lock(), $($args)*);
        |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
       ::: src/message.rs:178:13
        |
    178 |             println!();
        |             ---------- in this macro invocation
        |
        = help: consider adding a type annotation or removing the `let` keyword
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
        = note: this error originates in the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)

    error: non-binding `let` without a type annotation
       --> src/term.rs:42:9
        |
    42  |         let _ = std::writeln!($crate::term::lock(), $($args)*);
        |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
       ::: src/message.rs:191:9
        |
    191 |         println!("STDOUT:");
        |         ------------------- in this macro invocation
        |
        = help: consider adding a type annotation or removing the `let` keyword
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
        = note: this error originates in the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)

    error: non-binding `let` without a type annotation
       --> src/term.rs:42:9
        |
    42  |         let _ = std::writeln!($crate::term::lock(), $($args)*);
        |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
       ::: src/message.rs:193:9
        |
    193 |         println!();
        |         ---------- in this macro invocation
        |
        = help: consider adding a type annotation or removing the `let` keyword
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
        = note: this error originates in the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)

    error: non-binding `let` without a type annotation
       --> src/term.rs:42:9
        |
    42  |         let _ = std::writeln!($crate::term::lock(), $($args)*);
        |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
       ::: src/message.rs:203:5
        |
    203 |     println!("WARNINGS:");
        |     --------------------- in this macro invocation
        |
        = help: consider adding a type annotation or removing the `let` keyword
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
        = note: this error originates in the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)

    error: non-binding `let` without a type annotation
       --> src/term.rs:42:9
        |
    42  |         let _ = std::writeln!($crate::term::lock(), $($args)*);
        |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
       ::: src/message.rs:205:5
        |
    205 |     println!();
        |     ---------- in this macro invocation
        |
        = help: consider adding a type annotation or removing the `let` keyword
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
        = note: this error originates in the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)

    error: non-binding `let` without a type annotation
       --> src/term.rs:42:9
        |
    42  |         let _ = std::writeln!($crate::term::lock(), $($args)*);
        |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
       ::: src/message.rs:214:9
        |
    214 |         println!("{}", "┈".repeat(60));
        |         ------------------------------ in this macro invocation
        |
        = help: consider adding a type annotation or removing the `let` keyword
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
        = note: this error originates in the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)

    error: non-binding `let` without a type annotation
       --> src/term.rs:34:9
        |
    34  |         let _ = std::write!($crate::term::lock(), $($args)*);
        |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
       ::: src/message.rs:226:25
        |
    226 |                         print!("{}", s);
        |                         --------------- in this macro invocation
        |
        = help: consider adding a type annotation or removing the `let` keyword
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
        = note: this error originates in the macro `print` (in Nightly builds, run with -Z macro-backtrace for more info)

    error: non-binding `let` without a type annotation
       --> src/term.rs:34:9
        |
    34  |         let _ = std::write!($crate::term::lock(), $($args)*);
        |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
       ::: src/message.rs:230:25
        |
    230 |                         print!("\x1B[7m{}", s);
        |                         ---------------------- in this macro invocation
        |
        = help: consider adding a type annotation or removing the `let` keyword
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
        = note: this error originates in the macro `print` (in Nightly builds, run with -Z macro-backtrace for more info)

    error: non-binding `let` without a type annotation
       --> src/term.rs:34:9
        |
    34  |         let _ = std::write!($crate::term::lock(), $($args)*);
        |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
       ::: src/message.rs:235:17
        |
    235 |         None => print!("{}", content),
        |                 --------------------- in this macro invocation
        |
        = help: consider adding a type annotation or removing the `let` keyword
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
        = note: this error originates in the macro `print` (in Nightly builds, run with -Z macro-backtrace for more info)

    error: non-binding `let` without a type annotation
      --> src/term.rs:34:9
       |
    34 |         let _ = std::write!($crate::term::lock(), $($args)*);
       |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       |
      ::: src/run.rs:64:9
       |
    64 |         print!("\n\n");
       |         -------------- in this macro invocation
       |
       = help: consider adding a type annotation or removing the `let` keyword
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
       = note: this error originates in the macro `print` (in Nightly builds, run with -Z macro-backtrace for more info)

    error: non-binding `let` without a type annotation
      --> src/term.rs:34:9
       |
    34 |         let _ = std::write!($crate::term::lock(), $($args)*);
       |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       |
      ::: src/run.rs:98:9
       |
    98 |         print!("\n\n");
       |         -------------- in this macro invocation
       |
       = help: consider adding a type annotation or removing the `let` keyword
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
       = note: this error originates in the macro `print` (in Nightly builds, run with -Z macro-backtrace for more info)
dtolnay added a commit to dtolnay/syn that referenced this issue Feb 27, 2023
rust-lang/rust-clippy#10410

    error: non-binding `let` without a type annotation
      --> build.rs:20:5
       |
    20 |     let _ = compiler.minor;
       |     ^^^^^^^^^^^^^^^^^^^^^^^
       |
       = help: consider adding a type annotation or removing the `let` keyword
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
       = note: `-D clippy::let-underscore-untyped` implied by `-D clippy::pedantic`

    error: non-binding `let` without a type annotation
       --> src/lookahead.rs:104:9
        |
    104 |         let _ = token;
        |         ^^^^^^^^^^^^^^
        |
        = help: consider adding a type annotation or removing the `let` keyword
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
        = note: `-D clippy::let-underscore-untyped` implied by `-D clippy::pedantic`

    error: non-binding `let` without a type annotation
       --> src/parse.rs:379:5
        |
    379 |     let _ = proof;
        |     ^^^^^^^^^^^^^^
        |
        = help: consider adding a type annotation or removing the `let` keyword
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped

    error: non-binding `let` without a type annotation
       --> src/parse.rs:580:9
        |
    580 |         let _ = token;
        |         ^^^^^^^^^^^^^^
        |
        = help: consider adding a type annotation or removing the `let` keyword
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped

    error: non-binding `let` without a type annotation
       --> src/parse.rs:628:9
        |
    628 |         let _ = token;
        |         ^^^^^^^^^^^^^^
        |
        = help: consider adding a type annotation or removing the `let` keyword
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped

    error: non-binding `let` without a type annotation
       --> src/parse.rs:647:9
        |
    647 |         let _ = token;
        |         ^^^^^^^^^^^^^^
        |
        = help: consider adding a type annotation or removing the `let` keyword
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped

    error: non-binding `let` without a type annotation
       --> src/parse.rs:751:9
        |
    751 |         let _ = separator;
        |         ^^^^^^^^^^^^^^^^^^
        |
        = help: consider adding a type annotation or removing the `let` keyword
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped

    error: non-binding `let` without a type annotation
        --> src/parse.rs:1229:9
         |
    1229 |         let _ = scope;
         |         ^^^^^^^^^^^^^^
         |
         = help: consider adding a type annotation or removing the `let` keyword
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
@Jarcho Jarcho removed the I-false-positive Issue: The lint was triggered on code it shouldn't have label Feb 27, 2023
dtolnay added a commit to dtolnay/syn that referenced this issue Feb 27, 2023
rust-lang/rust-clippy#10410

    error: non-binding `let` without a type annotation
      --> build.rs:20:5
       |
    20 |     let _ = compiler.minor;
       |     ^^^^^^^^^^^^^^^^^^^^^^^
       |
       = help: consider adding a type annotation or removing the `let` keyword
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
       = note: `-D clippy::let-underscore-untyped` implied by `-D clippy::pedantic`

    error: non-binding `let` without a type annotation
       --> src/lookahead.rs:104:9
        |
    104 |         let _ = token;
        |         ^^^^^^^^^^^^^^
        |
        = help: consider adding a type annotation or removing the `let` keyword
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
        = note: `-D clippy::let-underscore-untyped` implied by `-D clippy::pedantic`

    error: non-binding `let` without a type annotation
       --> src/parse.rs:379:5
        |
    379 |     let _ = proof;
        |     ^^^^^^^^^^^^^^
        |
        = help: consider adding a type annotation or removing the `let` keyword
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped

    error: non-binding `let` without a type annotation
       --> src/parse.rs:580:9
        |
    580 |         let _ = token;
        |         ^^^^^^^^^^^^^^
        |
        = help: consider adding a type annotation or removing the `let` keyword
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped

    error: non-binding `let` without a type annotation
       --> src/parse.rs:628:9
        |
    628 |         let _ = token;
        |         ^^^^^^^^^^^^^^
        |
        = help: consider adding a type annotation or removing the `let` keyword
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped

    error: non-binding `let` without a type annotation
       --> src/parse.rs:647:9
        |
    647 |         let _ = token;
        |         ^^^^^^^^^^^^^^
        |
        = help: consider adding a type annotation or removing the `let` keyword
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped

    error: non-binding `let` without a type annotation
       --> src/parse.rs:751:9
        |
    751 |         let _ = separator;
        |         ^^^^^^^^^^^^^^^^^^
        |
        = help: consider adding a type annotation or removing the `let` keyword
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped

    error: non-binding `let` without a type annotation
        --> src/parse.rs:1229:9
         |
    1229 |         let _ = scope;
         |         ^^^^^^^^^^^^^^
         |
         = help: consider adding a type annotation or removing the `let` keyword
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
@Jarcho
Copy link
Contributor

Jarcho commented Feb 27, 2023

Doesn't seem like a false positive. I'm not sure what the point of the suggestion to remove the let keyword is for since it goes against the stated reason for the lint.

This might be better as a restriction lint. let _ = ... is used very frequently and there's nothing really wrong with it.

@dtolnay
Copy link
Member Author

dtolnay commented Feb 27, 2023

I'm not sure what the point of the suggestion to remove the let keyword is for

Based on the message outputted by the lint, I assumed this to be a "why waste time say lot word when few word do trick" lint: i.e. with the motivation that now that _ = ... is available, prevent people from writing let _ = ..., except if they wanted to put a non-inferred type, which is not supported by _ = ....

since it goes against the stated reason for the lint.

Yeah, going back and reading #6842, it seems my assumed interpretation is not at all the rationale behind the lint originally proposed. The purported reason that let _ = ... is bad also applies equally to _ = ....

@JirkaVebr
Copy link
Contributor

@dtolnay First of all, I'm really sorry about this issue. This was my first ever contribution made at @llogiq's excellent Clippy workshop, and I'm definitely no expert on this.

The intention behind the lint wasn't primarily to save tokens by dropping the let, but rather to nudge people towards providing a type ascription, thereby explicitly stating what exactly is it that they wish to ignore. That way their compile would break should the type of the ignored expression change, and they would be forced to re-evaluate the decision to ignore the value. Perhaps once the type is different, they would no longer wish to ignore the value? Hence the name of the lint: let_underscore_untyped ‒ it's really about the type. The "dropping the let" part is intended primarily for cases where the type cannot be named, is too complex, or the author just doesn't wish to spell out the type. But yes, _ = <expr> does suffer from the same problem the lint is trying to address.

Based on the message outputted by the lint

Is the message too misleading then? Perhaps it should be more clear that the recommended resolution is to provide the type ascription?

Regarding the MSRV, that is just a bug and an oversight on our part, thanks for pointing that out. For older versions of Rust, should it not recommend dropping the let or should it just be disabled? 🤔

@dtolnay
Copy link
Member Author

dtolnay commented Feb 27, 2023

IMO clippy should not ever suggest replacing let _ = ... with _ = ..., regardless of msrv, since that is not better.

@smoelius
Copy link
Contributor

smoelius commented Mar 2, 2023

This might be better as a restriction lint. let _ = ... is used very frequently and there's nothing really wrong with it.

I also think this might be better as a restriction lint.

bors added a commit that referenced this issue Mar 4, 2023
Downgrade let_underscore_untyped to restriction

From reading #6842 I am not convinced of the cost/benefit of this lint even as a pedantic lint.

It sounds like the primary motivation was to catch cases of `fn() -> Result` being changed to `async fn() -> Result`. If the original Result was ignored by a `let _`, then the compiler wouldn't guide you to add `.await`. **However, this situation is caught in a more specific way by [let_underscore_future](https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_future) which was introduced _after_ the original suggestion (#9760).**

In #10410 it was mentioned twice that a <kbd>restriction</kbd> lint might be more appropriate for let_underscore_untyped.

changelog: Moved [`let_underscore_untyped`] to restriction
@ryanavella
Copy link

ryanavella commented Mar 7, 2023

I can think of one advantage to _ = ..., which is that it more closely follows my intuition of drop-order.

Normally let bindings keep a value alive until the end of scope, but let _ = ... breaks that pattern. This is a common enough footgun that newcomers will often ask why let _ = lock.lock().unwrap(); doesn't lock a mutex for the duration of a scope, for example.

On the other hand, when I see a destructuring assignment like (x, _) = (1, FooWithNonTrivialDrop);, I expect FooWithNonTrivialDrop to be dropped immediately because it is not being bound to anything in particular. But I would like to know if this is consistent with other dev's intuitions, or if it is just peculiar to me and my own weird mental model.

@dtolnay
Copy link
Member Author

dtolnay commented Mar 7, 2023

I don't agree @ryanavella -- overall I don't feel that _ = puts anyone in a better spot to get away not understanding the special behavior of underscore patterns, compared to let _ =. Whether the mental model is "_ = means drop immediately", or "_ = works like ident =", those are both wrong and _ is its own thing, both in _ = and let _ =.

@JirkaVebr
Copy link
Contributor

I think the fundamental problem really are types that cannot be named (#10411). If I recall correctly, @llogiq said that it is either incredibly difficult or even impossible for Clippy to identify these, and so the suggestion to drop the let came to be largely as a way for the lint to move out of the way so that people aren't forced to write #[allow(clippy::let_underscore_untyped)] when it's really not their fault.

I do fully agree that _ = <expr> has plenty of downsides though. Assuming it was feasible to detect unnameable types, the lint could only trigger when there's a type for the user to write, and it could drop the suggestion to omit the let. Otherwise, if it isn't feasible, is it acceptable for there to be edge cases where #[allow(clippy::let_underscore_untyped)] is necessary even though it was not possible to name the type?

Separately, the MSRV and #10441 are just bugs that could be fixed right away no matter the answer to these questions.

I would love to contribute a fix but I was hoping to first also hear @llogiq's thoughts on all this. Which path could/should the fix take? Can we recognize unnameable types?

@blyxyas
Copy link
Member

blyxyas commented Apr 23, 2023

@rustbot claim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing I-suggestion-causes-error Issue: The suggestions provided by this Lint cause an ICE/error when applied
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants