Skip to content

Commit

Permalink
Workspace without sysroot could be possible
Browse files Browse the repository at this point in the history
  • Loading branch information
Ddystopia committed May 2, 2023
1 parent 7e19d99 commit 2025f17
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
18 changes: 8 additions & 10 deletions crates/ide/src/doc_links.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,17 +148,15 @@ pub(crate) fn external_docs(
let node = token.parent()?;
let definition = match_ast! {
match node {
ast::NameRef(name_ref) => match NameRefClass::classify(sema, &name_ref) {
Some(NameRefClass::Definition(def)) => def,
Some(NameRefClass::FieldShorthand { local_ref: _, field_ref }) => {
ast::NameRef(name_ref) => match NameRefClass::classify(sema, &name_ref)? {
NameRefClass::Definition(def) => def,
NameRefClass::FieldShorthand { local_ref: _, field_ref } => {
Definition::Field(field_ref)
}
None => return None,
},
ast::Name(name) => match NameClass::classify(sema, &name) {
Some(NameClass::Definition(it) | NameClass::ConstReference(it)) => it,
Some(NameClass::PatFieldShorthand { local_def: _, field_ref }) => Definition::Field(field_ref),
None => return None,
ast::Name(name) => match NameClass::classify(sema, &name)? {
NameClass::Definition(it) | NameClass::ConstReference(it) => it,
NameClass::PatFieldShorthand { local_def: _, field_ref } => Definition::Field(field_ref),
},
_ => return None
}
Expand Down Expand Up @@ -347,10 +345,10 @@ fn get_doc_links(
web_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()),
local_url: local_url.map(|it| it.into()),
};
}
}

fn rewrite_intra_doc_link(
Expand Down
2 changes: 1 addition & 1 deletion crates/rust-analyzer/src/handlers/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1546,7 +1546,7 @@ pub(crate) fn handle_open_docs(
});

let (cargo, sysroot) = match ws_and_sysroot {
Some((ws, Some(sysroot))) => (Some(ws), Some(sysroot)),
Some((ws, sysroot)) => (Some(ws), sysroot),
_ => (None, None),
};

Expand Down

0 comments on commit 2025f17

Please sign in to comment.