mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-15 17:28:09 +00:00
Workspace without sysroot could be possible
This commit is contained in:
parent
7e19d99d4f
commit
2025f17ac3
2 changed files with 9 additions and 11 deletions
|
@ -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(
|
||||||
|
|
|
@ -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),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue