7498: Clone for update r=matklad a=matklad

rowan counterpart https://github.com/rust-analyzer/rowan/pull/93

#6857

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
bors[bot] 2021-03-16 13:14:48 +00:00 committed by GitHub
commit c49b5b7468
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
41 changed files with 376 additions and 176 deletions

View file

@ -92,7 +92,7 @@ pub(crate) fn hover(
let mut res = HoverResult::default();
let node = token.parent();
let node = token.parent()?;
let definition = match_ast! {
match node {
// we don't use NameClass::referenced_or_defined here as we do not want to resolve
@ -421,7 +421,7 @@ fn hover_for_keyword(
if !token.kind().is_keyword() {
return None;
}
let famous_defs = FamousDefs(&sema, sema.scope(&token.parent()).krate());
let famous_defs = FamousDefs(&sema, sema.scope(&token.parent()?).krate());
// std exposes {}_keyword modules with docstrings on the root to document keywords
let keyword_mod = format!("{}_keyword", token.text());
let doc_owner = find_std_module(&famous_defs, &keyword_mod)?;