kevinmehall/rust-peg

rustc warning about unused imports

mcandre opened this issue · 1 comments

Hi,

I am able to use a regex initialized in lazy_static, in my grammar for some tricky {? ... } logic.

However, rustc warns that the regex is "unused". Even though it is used by the peg grammar.

I tried moving the extern crate regex; and use regex::Regex; lines into the grammar. That causes compilation to completely fail.

I tried moving the imports into lazy_static. Same behavior: Compilation fails.

Alternatively, I could construct the regex in the grammar rule every time, but that dampens performance.

How can we get rustc to witness a grammar using a lazy_static member?

Please provide a complete example and the compiler error.