maplit icon indicating copy to clipboard operation
maplit copied to clipboard

update doc for Rust edition 2018 not requiring 'extern crate'

Open jmegner opened this issue 6 years ago • 0 comments

As a newcomer to Rust, I was mislead by the crate doc example code into thinking that #[macro_use] extern crate maplit; was needed to use maplit's macros. I was using Rust edition 2018 and use maplit::{hashmap, btreeset}; was actually what I needed.

Is there some way to have the doc state what is needed for Rust edition 2015 and what is needed for Rust edition 2018? If it doesn't offend your sense of aesthetics, something as simple as the following would have been great for someone like me who was unaware of Rust edition 2018 removing almost all need for usage of extern crate:

#[macro_use] extern crate maplit; // only for Rust edition 2015
use maplit::hashmap; // for Rust edition 2018

Many thanks for your wonderful crate.

jmegner avatar Jan 05 '20 16:01 jmegner