rust-lang / rust-clippy

A bunch of lints to catch common mistakes and improve your Rust code. Book: https://doc.rust-lang.org/clippy/
https://rust-lang.github.io/rust-clippy/
Other
11.3k stars 1.53k forks source link

`expect_unstable` lint for feature instability assertions #13330

Open onkoe opened 4 weeks ago

onkoe commented 4 weeks ago

What it does

This lint notifies a user when a given feature is stable. It lets users mark blocks, items, and statements with an expectation: #[expect_unstable("some_unstable_feature")]

Configuration

Advantage

Drawbacks

No response

Example

// FIXME: make sure to use `core::error::Error` when stable!
// i sure hope someone notices this after 1.81..!
use std::error::Error;

Could be written as:

#[expect_unstable("error_in_core")]
use std::error::Error;
Jarcho commented 2 weeks ago

Just since I was confused when I read this the first time, this is intended to label code which is supposed to be changed once a feature becomes stable?

Nominated as this is related to a potential change to how we handle MSRVs.

onkoe commented 2 weeks ago

@Jarcho Yes, you have it right! It's intended to alert users when unstable features are stabilized.

Jarcho commented 1 week ago

Discussed this briefly at the last meeting. There were no objections to doing this. This won't need a config option for MSRV handling since #13416 would handle that in a more general way.