10795: Remove unwrap in doc path resolution r=Veykril a=udoprog

I keep hitting this constantly in my project, and I haven't dug very deep into the root cause. But seeing as the project otherwise compiles it appears to be something unsupported is being incorrectly parsed in rust-analyzer which for other cases is handled by returning `None`.

Co-authored-by: John-John Tedro <udoprog@tedro.se>
This commit is contained in:
bors[bot] 2021-11-18 09:40:59 +00:00 committed by GitHub
commit b844d453b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -147,7 +147,7 @@ fn resolve_doc_path(
AttrDefId::MacroDefId(_) => return None,
};
let path = ast::Path::parse(link).ok()?;
let modpath = ModPath::from_src(db.upcast(), path, &Hygiene::new_unhygienic()).unwrap();
let modpath = ModPath::from_src(db.upcast(), path, &Hygiene::new_unhygienic())?;
let resolved = resolver.resolve_module_path_in_items(db.upcast(), &modpath);
let resolved = if resolved == PerNs::none() {
resolver.resolve_module_path_in_trait_assoc_items(db.upcast(), &modpath)?