Other crates, like lazy_static
require the annotation #[macro_use]
to export macros, why does the log
crate work without?
extern crate log;
use log::{warn};
fn main() {
warn!("why isn't #[macro_use] needed?")
}
Other crates, like lazy_static
require the annotation #[macro_use]
to export macros, why does the log
crate work without?
extern crate log;
use log::{warn};
fn main() {
warn!("why isn't #[macro_use] needed?")
}
And the same goes for extern crate
. Your example can be written simply as
use log::warn;
fn main() {
warn!("why isn't #[macro_use] needed?")
}
or
fn main() {
log::warn!("why isn't #[macro_use] needed?")
}
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.