extern crate rustc_hir;
extern crate rustc_lint;
extern crate rustc_span;
use rustc_hir::def_id::DefId;
use rustc_lint::LateContext;
use rustc_span::symbol::Symbol;
pub fn match_any_def_paths(cx: &LateContext<'_>, did: DefId, paths: &[&[&str]]) -> Option<usize> {
let search_path = cx.get_def_path(did);
paths.iter().position(|p| {
p.iter()
.map(|x| Symbol::intern(x))
.eq(search_path.iter().copied())
})
}
pub fn match_def_path(cx: &LateContext<'_>, did: DefId, syms: &[&str]) -> bool {
let path = cx.get_def_path(did);
syms.iter()
.map(|x| Symbol::intern(x))
.eq(path.iter().copied())
}