Closed
Description
I tried this code:
(edition 2024)
#![warn(unused_extern_crates)]
#![no_implicit_prelude]
extern crate std;
fn main() {
let r = 1u16..10;
std::println!("{:?}", r.is_empty());
}
=>
warning: `extern crate` is not idiomatic in the new edition
--> src/main.rs:4:1
|
4 | extern crate std;
| ^^^^^^^^^^^^^^^^^
|
note: the lint level is defined here
--> src/main.rs:1:9
|
1 | #![warn(unused_extern_crates)]
| ^^^^^^^^^^^^^^^^^^^^
help: convert it to a `use`
|
4 - extern crate std;
4 + use std;
the suggested code
#![warn(unused_extern_crates)]
#![no_implicit_prelude]
use std;
fn main() {
let r = 1u16..10;
std::println!("{:?}", r.is_empty());
}
does not compile:
error[E0432]: unresolved import `std`
--> src/main.rs:4:5
|
4 | use std;
| ^^^ no external crate `std`
For more information about this error, try `rustc --explain E0432`.
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Category: This is a bug.Diagnostics: A structured suggestion resulting in incorrect code.Lint: unused_extern_cratesRelevant to the compiler team, which will review and decide on the PR/issue.