Function clippy_utils::match_qpath

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

THIS METHOD IS DEPRECATED. Matches a QPath against a slice of segment string literals.

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().

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"])