mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
Rustfmt to pass CI
This commit is contained in:
parent
a83ed374d0
commit
c29f158c20
3 changed files with 12 additions and 6 deletions
|
@ -261,7 +261,7 @@ impl Analysis {
|
||||||
pub fn doc_comment_for(
|
pub fn doc_comment_for(
|
||||||
&self,
|
&self,
|
||||||
file_id: FileId,
|
file_id: FileId,
|
||||||
symbol: FileSymbol
|
symbol: FileSymbol,
|
||||||
) -> Cancelable<Option<String>> {
|
) -> Cancelable<Option<String>> {
|
||||||
self.imp.doc_comment_for(file_id, symbol)
|
self.imp.doc_comment_for(file_id, symbol)
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,12 +24,17 @@ pub struct FileSymbol {
|
||||||
|
|
||||||
impl FileSymbol {
|
impl FileSymbol {
|
||||||
pub fn docs(&self, file: &File) -> Option<String> {
|
pub fn docs(&self, file: &File) -> Option<String> {
|
||||||
file.syntax().descendants()
|
file.syntax()
|
||||||
|
.descendants()
|
||||||
.filter(|node| node.kind() == self.kind && node.range() == self.node_range)
|
.filter(|node| node.kind() == self.kind && node.range() == self.node_range)
|
||||||
.filter_map(|node: SyntaxNodeRef| {
|
.filter_map(|node: SyntaxNodeRef| {
|
||||||
fn doc_comments<'a, N: DocCommentsOwner<'a>>(node: N) -> Option<String> {
|
fn doc_comments<'a, N: DocCommentsOwner<'a>>(node: N) -> Option<String> {
|
||||||
let comments = node.doc_comment_text();
|
let comments = node.doc_comment_text();
|
||||||
if comments.is_empty() { None } else { Some(comments) }
|
if comments.is_empty() {
|
||||||
|
None
|
||||||
|
} else {
|
||||||
|
Some(comments)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
visitor()
|
visitor()
|
||||||
|
@ -42,7 +47,8 @@ impl FileSymbol {
|
||||||
.visit(doc_comments::<ast::ConstDef>)
|
.visit(doc_comments::<ast::ConstDef>)
|
||||||
.visit(doc_comments::<ast::StaticDef>)
|
.visit(doc_comments::<ast::StaticDef>)
|
||||||
.accept(node)?
|
.accept(node)?
|
||||||
}).nth(0)
|
})
|
||||||
|
.nth(0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -494,8 +494,8 @@ pub fn handle_hover(
|
||||||
|
|
||||||
return Ok(Some(Hover {
|
return Ok(Some(Hover {
|
||||||
contents,
|
contents,
|
||||||
range: Some(range)
|
range: Some(range),
|
||||||
}))
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue