fn handle_path(&mut self, path: &rustc_hir::Path<'_>, path_span: Option<Span>) {
        let info = match path.res {
            // FIXME: For now, we only handle `DefKind` if it's not `DefKind::TyParam` or
            // `DefKind::Macro`. Would be nice to support them too alongside the other `DefKind`
            // (such as primitive types!).
            Res::Def(kind, def_id) if kind != DefKind::TyParam => {
                if matches!(kind, DefKind::Macro(_)) {
                    return;
                }
                Some(def_id)
            }
            Res::Local(_) => None,
            Res::PrimTy(p) => {
                // FIXME: Doesn't handle "path-like" primitives like arrays or tuples.
                let span = path_span.unwrap_or(path.span);
                self.matches.insert(span, LinkFromSrc::Primitive(PrimitiveType::from(p)));
                return;
            }
            Res::Err => return,
            _ => return,
        };
        if let Some(span) = self.tcx.hir().res_span(path.res) {
            self.matches
                .insert(path_span.unwrap_or(path.span), LinkFromSrc::Local(clean::Span::new(span)));
        } else if let Some(def_id) = info {
            self.matches.insert(path_span.unwrap_or(path.span), LinkFromSrc::External(def_id));
        }
    }
/// This function is where we handle `hir::Path` elements and add them into the "span map".
This function is where we handle `hir::Path` elements and add them into the "span map".
This function is where we handle ` hir :: Path ` elements and add them into the " span map " .
fn handle_path(&mut self, path: &rustc_hir::Path<'_>, path_span: Option<Span>) {
        let info = match path.res {
            // FIXME: For now, we only handle `DefKind` if it's not `DefKind::TyParam` or
            // `DefKind::Macro`. Would be nice to support them too alongside the other `DefKind`
            // (such as primitive types!).
            Res::Def(kind, def_id) if kind != DefKind::TyParam => {
                if matches!(kind, DefKind::Macro(_)) {
                    return;
                }
                Some(def_id)
            }
            Res::Local(_) => None,
            Res::PrimTy(p) => {
                // FIXME: Doesn't handle "path-like" primitives like arrays or tuples.
                let span = path_span.unwrap_or(path.span);
                self.matches.insert(span, LinkFromSrc::Primitive(PrimitiveType::from(p)));
                return;
            }
            Res::Err => return,
            _ => return,
        };
        if let Some(span) = self.tcx.hir().res_span(path.res) {
            self.matches
                .insert(path_span.unwrap_or(path.span), LinkFromSrc::Local(clean::Span::new(span)));
        } else if let Some(def_id) = info {
            self.matches.insert(path_span.unwrap_or(path.span), LinkFromSrc::External(def_id));
        }
    }
fn handle_path ( & mut self , path : & rustc_hir :: Path < ' _ > , path_span : Option < Span > ) { let info = match path . res { // FIXME: For now, we only handle `DefKind` if it's not `DefKind::TyParam` or // `DefKind::Macro`. Would be nice to support them too alongside the other `DefKind` // (such as primitive types!). Res :: Def ( kind , def_id ) if kind != DefKind :: TyParam => { if matches ! ( kind DefKind Macro ( ) ) { return ; } Some ( def_id ) } Res :: Local ( _ ) => None , Res :: PrimTy ( p ) => { // FIXME: Doesn't handle "path-like" primitives like arrays or tuples. let span = path_span . unwrap_or ( path . span ) ; self . matches . insert ( span , LinkFromSrc :: Primitive ( PrimitiveType :: from ( p ) ) ) ; return ; } Res :: Err => return , _ => return , } ; if let Some ( span ) = self . tcx . hir ( ) . res_span ( path . res ) { self . matches . insert ( path_span . unwrap_or ( path . span ) , LinkFromSrc :: Local ( clean :: Span :: new ( span ) ) ) ; } else if let Some ( def_id ) = info { self . matches . insert ( path_span . unwrap_or ( path . span ) , LinkFromSrc :: External ( def_id ) ) ; } }
This function is where we handle `hir::Path` elements and add them into the "span map".
This function is where we handle ` hir :: Path ` elements and add them into the " span map " .
&mut self
path
&rustc_hir::Path<'_>
path_span
Option<Span>
&mut self
path
&rustc_hir::Path<'_>
path_span
Option<Span>