Open mcandre opened 1 year ago
When I construct a regex in a lazy_static, then rustc often presents a spurious warning that the regex import is unused.
lazy_static
I tried moving use regex::Regex; into lazy_static, but that actually makes the compilation hard fail.
use regex::Regex;
I also added a unit test with #[test], but that still triggers the spurious unused import warning.
#[test]
What are we supposed to do to resolve that?
For context, this problem happens when using lazy_static members inside of a PEG grammar.
(I know, weird to import the regex library into a PEG grammar. But I have my reasons.)
Can you provide an example that others can reproduce please?
When I construct a regex in a
lazy_static
, then rustc often presents a spurious warning that the regex import is unused.I tried moving
use regex::Regex;
intolazy_static
, but that actually makes the compilation hard fail.I also added a unit test with
#[test]
, but that still triggers the spurious unused import warning.What are we supposed to do to resolve that?
For context, this problem happens when using
lazy_static
members inside of a PEG grammar.(I know, weird to import the regex library into a PEG grammar. But I have my reasons.)