From 663749beab2eeaaaf2b7d24fe2f721237d1d4dc0 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 25 Aug 2020 12:47:36 +0200 Subject: Minor --- crates/hir/src/doc_links.rs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/crates/hir/src/doc_links.rs b/crates/hir/src/doc_links.rs index dd2379bfc..a77758675 100644 --- a/crates/hir/src/doc_links.rs +++ b/crates/hir/src/doc_links.rs @@ -2,12 +2,12 @@ use std::iter::once; +use hir_def::{db::DefDatabase, resolver::Resolver}; use itertools::Itertools; +use syntax::ast::Path; use url::Url; use crate::{db::HirDatabase, Adt, AsName, Crate, Hygiene, ItemInNs, ModPath, ModuleDef}; -use hir_def::{db::DefDatabase, resolver::Resolver}; -use syntax::ast::Path; pub fn resolve_doc_link( db: &D, @@ -16,12 +16,9 @@ pub fn resolve_doc_link( link_target: &str, ) -> Option<(String, String)> { try_resolve_intra(db, definition, link_text, &link_target).or_else(|| { - if let Some(definition) = definition.clone().try_into_module_def() { - try_resolve_path(db, &definition, &link_target) - .map(|target| (target, link_text.to_string())) - } else { - None - } + let definition = definition.clone().try_into_module_def()?; + try_resolve_path(db, &definition, &link_target) + .map(|target| (target, link_text.to_string())) }) } @@ -57,7 +54,7 @@ fn try_resolve_intra( Some(ns @ Namespace::Types) => (resolved.types?.0, ns), Some(ns @ Namespace::Values) => (resolved.values?.0, ns), // FIXME: - Some(Namespace::Macros) => None?, + Some(Namespace::Macros) => return None, }; // Get the filepath of the final symbol -- cgit v1.2.3