mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 23:25:03 +00:00
Reformat all
This commit is contained in:
parent
857c1650ef
commit
6be50f7d5d
35 changed files with 423 additions and 367 deletions
|
@ -66,7 +66,9 @@ pub trait AttrsOwner<'a>: AstNode<'a> {
|
|||
}
|
||||
|
||||
pub trait DocCommentsOwner<'a>: AstNode<'a> {
|
||||
fn doc_comments(self) -> AstChildren<'a, Comment<'a>> { children(self) }
|
||||
fn doc_comments(self) -> AstChildren<'a, Comment<'a>> {
|
||||
children(self)
|
||||
}
|
||||
|
||||
/// Returns the textual content of a doc comment block as a single string.
|
||||
/// That is, strips leading `///` and joins lines
|
||||
|
@ -74,12 +76,15 @@ pub trait DocCommentsOwner<'a>: AstNode<'a> {
|
|||
self.doc_comments()
|
||||
.map(|comment| {
|
||||
let prefix = comment.prefix();
|
||||
let trimmed = comment.text().as_str()
|
||||
let trimmed = comment
|
||||
.text()
|
||||
.as_str()
|
||||
.trim()
|
||||
.trim_start_matches(prefix)
|
||||
.trim_start();
|
||||
trimmed.to_owned()
|
||||
}).join("\n")
|
||||
})
|
||||
.join("\n")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -250,7 +255,6 @@ impl<'a> IfExpr<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub enum PathSegmentKind<'a> {
|
||||
Name(NameRef<'a>),
|
||||
|
@ -261,7 +265,9 @@ pub enum PathSegmentKind<'a> {
|
|||
|
||||
impl<'a> PathSegment<'a> {
|
||||
pub fn parent_path(self) -> Path<'a> {
|
||||
self.syntax().parent().and_then(Path::cast)
|
||||
self.syntax()
|
||||
.parent()
|
||||
.and_then(Path::cast)
|
||||
.expect("segments are always nested in paths")
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue