Description
I have a project with a module that re-exports other definitions as follows:
mod defs {
#[cfg(feature = "std")]
pub use std::vec;
#[cfg(not(feature = "std"))]
pub use alloc::vec;
}
Oftentimes I want to use the vec!
macro and Vec
type like so:
use defs::{
vec,
vec::Vec,
};
However, rustfmt
thinks this is worse than
use defs::vec::{self, Vec};
However, this has different semantics since vec
above refers to the vec!
macro while self
in the replaced variant refers to the vec
submodule of defs
. So I can no longer access the vec!
macro whenever rustfmt
replaced this.
To be honest: I don't know whether this is a rustfmt
bug or a Rust compiler bug.