mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-12-21 10:33:27 +00:00
13 lines
321 B
Rust
13 lines
321 B
Rust
|
use rustc::lint::Context;
|
||
|
use syntax::codemap::ExpnInfo;
|
||
|
|
||
|
fn in_macro(cx: &Context, opt_info: Option<&ExpnInfo>) -> bool {
|
||
|
opt_info.map_or(false, |info| {
|
||
|
info.callee.span.map_or(true, |span| {
|
||
|
cx.sess().codemap().span_to_snippet(span).ok().map_or(true, |code|
|
||
|
!code.starts_with("macro_rules")
|
||
|
)
|
||
|
})
|
||
|
})
|
||
|
}
|