Skip to content

Commit 2025f17

Browse files
committed
Workspace without sysroot could be possible
1 parent 7e19d99 commit 2025f17

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

crates/ide/src/doc_links.rs

+8-10
Original file line numberDiff line numberDiff line change
@@ -148,17 +148,15 @@ pub(crate) fn external_docs(
148148
let node = token.parent()?;
149149
let definition = match_ast! {
150150
match node {
151-
ast::NameRef(name_ref) => match NameRefClass::classify(sema, &name_ref) {
152-
Some(NameRefClass::Definition(def)) => def,
153-
Some(NameRefClass::FieldShorthand { local_ref: _, field_ref }) => {
151+
ast::NameRef(name_ref) => match NameRefClass::classify(sema, &name_ref)? {
152+
NameRefClass::Definition(def) => def,
153+
NameRefClass::FieldShorthand { local_ref: _, field_ref } => {
154154
Definition::Field(field_ref)
155155
}
156-
None => return None,
157156
},
158-
ast::Name(name) => match NameClass::classify(sema, &name) {
159-
Some(NameClass::Definition(it) | NameClass::ConstReference(it)) => it,
160-
Some(NameClass::PatFieldShorthand { local_def: _, field_ref }) => Definition::Field(field_ref),
161-
None => return None,
157+
ast::Name(name) => match NameClass::classify(sema, &name)? {
158+
NameClass::Definition(it) | NameClass::ConstReference(it) => it,
159+
NameClass::PatFieldShorthand { local_def: _, field_ref } => Definition::Field(field_ref),
162160
},
163161
_ => return None
164162
}
@@ -347,10 +345,10 @@ fn get_doc_links(
347345
web_url.as_mut().map(|url| url.set_fragment(frag.as_deref()));
348346
local_url.as_mut().map(|url| url.set_fragment(frag.as_deref()));
349347

350-
return DocumentationLinks {
348+
DocumentationLinks {
351349
web_url: web_url.map(|it| it.into()),
352350
local_url: local_url.map(|it| it.into()),
353-
};
351+
}
354352
}
355353

356354
fn rewrite_intra_doc_link(

crates/rust-analyzer/src/handlers/request.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1546,7 +1546,7 @@ pub(crate) fn handle_open_docs(
15461546
});
15471547

15481548
let (cargo, sysroot) = match ws_and_sysroot {
1549-
Some((ws, Some(sysroot))) => (Some(ws), Some(sysroot)),
1549+
Some((ws, sysroot)) => (Some(ws), sysroot),
15501550
_ => (None, None),
15511551
};
15521552

0 commit comments

Comments
 (0)