How to use prelude_import attribute?

I understand the #[prelude_import] attribute is nightly, but I want to use it anyway. It seems like it works:


pub mod p {
    pub fn f() {

use p::*;

mod q {
    pub fn q() {

fn main() {

It prints Hello!, however the compiler says:

warning: unused import: `p::*`
  --> src/
10 | use p::*;
   |     ^^^^

I can probably disable the warning, but why does it happen?

Unstable features are allowed to be a little quirky... but FWIW, both core and std have #[allow(unused)] on their use of this feature.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.