Skip to content

let_underscore_untyped fails to consider configured msrv #10410

Closed
@dtolnay

Description

@dtolnay

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

Metadata

Metadata

Assignees

Labels

C-bugCategory: Clippy is not doing the correct thingI-suggestion-causes-errorIssue: The suggestions provided by this Lint cause an ICE/error when applied

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions