@@ -357,15 +357,6 @@ pub fn match_qpath(path: &QPath<'_>, segments: &[&str]) -> bool {
357357 }
358358}
359359
360- /// If the expression is a path, resolve it. Otherwise, return `Res::Err`.
361- pub fn expr_path_res ( cx : & LateContext < ' _ > , expr : & Expr < ' _ > ) -> Res {
362- if let ExprKind :: Path ( p) = & expr. kind {
363- cx. qpath_res ( p, expr. hir_id )
364- } else {
365- Res :: Err
366- }
367- }
368-
369360/// Resolves the path to a `DefId` and checks if it matches the given path.
370361pub fn is_qpath_def_path ( cx : & LateContext < ' _ > , path : & QPath < ' _ > , hir_id : HirId , segments : & [ & str ] ) -> bool {
371362 cx. qpath_res ( path, hir_id)
@@ -377,17 +368,13 @@ pub fn is_qpath_def_path(cx: &LateContext<'_>, path: &QPath<'_>, hir_id: HirId,
377368///
378369/// Please use `is_expr_diagnostic_item` if the target is a diagnostic item.
379370pub fn is_expr_path_def_path ( cx : & LateContext < ' _ > , expr : & Expr < ' _ > , segments : & [ & str ] ) -> bool {
380- expr_path_res ( cx, expr)
381- . opt_def_id ( )
382- . map_or ( false , |id| match_def_path ( cx, id, segments) )
371+ path_def_id ( cx, expr) . map_or ( false , |id| match_def_path ( cx, id, segments) )
383372}
384373
385374/// If the expression is a path, resolves it to a `DefId` and checks if it matches the given
386375/// diagnostic item.
387376pub fn is_expr_diagnostic_item ( cx : & LateContext < ' _ > , expr : & Expr < ' _ > , diag_item : Symbol ) -> bool {
388- expr_path_res ( cx, expr)
389- . opt_def_id ( )
390- . map_or ( false , |id| cx. tcx . is_diagnostic_item ( diag_item, id) )
377+ path_def_id ( cx, expr) . map_or ( false , |id| cx. tcx . is_diagnostic_item ( diag_item, id) )
391378}
392379
393380/// THIS METHOD IS DEPRECATED and will eventually be removed since it does not match against the
0 commit comments