Summary
Items sometimes move from std to core. For example, *UnwindSafe have moved, std::error::Error will move in Rust 1.81.0, and std::io::Error might someday.
When this happens, anyone who uses clippy from nightly or beta, or newer than their MSRV, will get lints they cannot satisfy. Therefore, it would be useful if std_instead_of_core, alloc_instead_of_core, and std_instead_of_alloc were MSRV-aware and only fired if the item in question is stable in core or alloc at the declared MSRV.
Lint Name
std_instead_of_core, alloc_instead_of_core, std_instead_of_alloc
Reproducer
I tried this code:
#![feature(custom_inner_attributes)]
#![warn(clippy::std_instead_of_core)]
#![clippy::msrv = "1.80.0"]
use std::error::Error;
I saw this happen:
warning: used import from `std` instead of `core`
--> src/lib.rs:5:5
|
5 | use std::error::Error;
| ^^^ help: consider importing the item from `core`: `core`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#std_instead_of_core
note: the lint level is defined here
--> src/lib.rs:2:9
|
2 | #![warn(clippy::std_instead_of_core)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
I expected to see this happen: No warning
Version
rustc 1.82.0-nightly (c1a6199e9 2024-07-24)
binary: rustc
commit-hash: c1a6199e9d92bb785c17a6d7ffd8b8b552f79c10
commit-date: 2024-07-24
host: x86_64-apple-darwin
release: 1.82.0-nightly
LLVM version: 18.1.7
Additional Labels
@rustbot label -C-bug +C-enhancement
Summary
Items sometimes move from
stdtocore. For example,*UnwindSafehave moved,std::error::Errorwill move in Rust 1.81.0, andstd::io::Errormight someday.When this happens, anyone who uses clippy from nightly or beta, or newer than their MSRV, will get lints they cannot satisfy. Therefore, it would be useful if
std_instead_of_core,alloc_instead_of_core, andstd_instead_of_allocwere MSRV-aware and only fired if the item in question is stable incoreorallocat the declared MSRV.Lint Name
std_instead_of_core, alloc_instead_of_core, std_instead_of_alloc
Reproducer
I tried this code:
I saw this happen:
I expected to see this happen: No warning
Version
Additional Labels
@rustbot label -C-bug +C-enhancement