Workspace without sysroot could be possible

This commit is contained in:
Ddystopia 2023-05-01 10:16:36 +02:00
parent 7e19d99d4f
commit 2025f17ac3
No known key found for this signature in database
GPG Key ID: 109875EC11535212
2 changed files with 9 additions and 11 deletions

View File

@ -148,17 +148,15 @@ pub(crate) fn external_docs(
let node = token.parent()?; let node = token.parent()?;
let definition = match_ast! { let definition = match_ast! {
match node { match node {
ast::NameRef(name_ref) => match NameRefClass::classify(sema, &name_ref) { ast::NameRef(name_ref) => match NameRefClass::classify(sema, &name_ref)? {
Some(NameRefClass::Definition(def)) => def, NameRefClass::Definition(def) => def,
Some(NameRefClass::FieldShorthand { local_ref: _, field_ref }) => { NameRefClass::FieldShorthand { local_ref: _, field_ref } => {
Definition::Field(field_ref) Definition::Field(field_ref)
} }
None => return None,
}, },
ast::Name(name) => match NameClass::classify(sema, &name) { ast::Name(name) => match NameClass::classify(sema, &name)? {
Some(NameClass::Definition(it) | NameClass::ConstReference(it)) => it, NameClass::Definition(it) | NameClass::ConstReference(it) => it,
Some(NameClass::PatFieldShorthand { local_def: _, field_ref }) => Definition::Field(field_ref), NameClass::PatFieldShorthand { local_def: _, field_ref } => Definition::Field(field_ref),
None => return None,
}, },
_ => return None _ => return None
} }
@ -347,10 +345,10 @@ fn get_doc_links(
web_url.as_mut().map(|url| url.set_fragment(frag.as_deref())); web_url.as_mut().map(|url| url.set_fragment(frag.as_deref()));
local_url.as_mut().map(|url| url.set_fragment(frag.as_deref())); local_url.as_mut().map(|url| url.set_fragment(frag.as_deref()));
return DocumentationLinks { DocumentationLinks {
web_url: web_url.map(|it| it.into()), web_url: web_url.map(|it| it.into()),
local_url: local_url.map(|it| it.into()), local_url: local_url.map(|it| it.into()),
}; }
} }
fn rewrite_intra_doc_link( fn rewrite_intra_doc_link(

View File

@ -1546,7 +1546,7 @@ pub(crate) fn handle_open_docs(
}); });
let (cargo, sysroot) = match ws_and_sysroot { let (cargo, sysroot) = match ws_and_sysroot {
Some((ws, Some(sysroot))) => (Some(ws), Some(sysroot)), Some((ws, sysroot)) => (Some(ws), sysroot),
_ => (None, None), _ => (None, None),
}; };