If your code uses the
std::ascii::AsciiExt trait and you upgrade your compiler to today’s Nightly, you might see a warning like this:
warning: unused import: `std::ascii::AsciiExt` --> /home/simon/servo3/components/script/dom/bindings/str.rs:10:5 | 10 | use std::ascii::AsciiExt; | ^^^^^^^^^^^^^^^^^^^^ | = note: #[warn(unused_imports)] on by default
This is because https://github.com/rust-lang/rust/pull/44042 has just landed, making some of this trait’s methods available as inherent methods. The inherent ones take priority in method resolution, so the trait is now unused.
If you only need to support one compiler version you can just remove the
use line. But if you also want to compile without warnings on both the Stable and Nightly channels (say if you maintain a library) the trick for now is to silence the warning just for that line:
#[allow(unused_imports)] use std::ascii::AsciiExt;
unused_imports plural, not
#[…] syntax instead of
#![…] makes this attribute apply only to the following item, not the entire module.
After the new inherent methods reach the stable channel we’ll deprecate the
AsciiExt trait in Nigthly and you’ll get new warnings. At that point it should be safe to remove these imports entirely.