Function clippy_utils::match_qpath

source ·
pub fn match_qpath(path: &QPath<'_>, segments: &[&str]) -> bool
Expand description

THIS METHOD IS DEPRECATED and will eventually be removed since it does not match against the entire path or resolved DefId. Prefer using match_def_path. Consider getting a DefId from QPath::Resolved.1.res.opt_def_id().

Matches a QPath against a slice of segment string literals.

There is also match_path if you are dealing with a rustc_hir::Path instead of a rustc_hir::QPath.

Examples

match_qpath(path, &["std", "rt", "begin_unwind"])