diff options
author | Aleksey Kladov <[email protected]> | 2018-10-31 20:41:43 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-10-31 20:41:43 +0000 |
commit | 6be50f7d5de3737464853a589673375fc0cafa97 (patch) | |
tree | 2c6da7f3a1234c3f2fd3f330d2c9445953979598 /crates/ra_syntax/src/ast/mod.rs | |
parent | 857c1650efdb51650458f9ec1119adaa49b34371 (diff) |
Reformat all
Diffstat (limited to 'crates/ra_syntax/src/ast/mod.rs')
-rw-r--r-- | crates/ra_syntax/src/ast/mod.rs | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/crates/ra_syntax/src/ast/mod.rs b/crates/ra_syntax/src/ast/mod.rs index 3aa11b9dd..688ffff47 100644 --- a/crates/ra_syntax/src/ast/mod.rs +++ b/crates/ra_syntax/src/ast/mod.rs | |||
@@ -66,7 +66,9 @@ pub trait AttrsOwner<'a>: AstNode<'a> { | |||
66 | } | 66 | } |
67 | 67 | ||
68 | pub trait DocCommentsOwner<'a>: AstNode<'a> { | 68 | pub trait DocCommentsOwner<'a>: AstNode<'a> { |
69 | fn doc_comments(self) -> AstChildren<'a, Comment<'a>> { children(self) } | 69 | fn doc_comments(self) -> AstChildren<'a, Comment<'a>> { |
70 | children(self) | ||
71 | } | ||
70 | 72 | ||
71 | /// Returns the textual content of a doc comment block as a single string. | 73 | /// Returns the textual content of a doc comment block as a single string. |
72 | /// That is, strips leading `///` and joins lines | 74 | /// That is, strips leading `///` and joins lines |
@@ -74,12 +76,15 @@ pub trait DocCommentsOwner<'a>: AstNode<'a> { | |||
74 | self.doc_comments() | 76 | self.doc_comments() |
75 | .map(|comment| { | 77 | .map(|comment| { |
76 | let prefix = comment.prefix(); | 78 | let prefix = comment.prefix(); |
77 | let trimmed = comment.text().as_str() | 79 | let trimmed = comment |
80 | .text() | ||
81 | .as_str() | ||
78 | .trim() | 82 | .trim() |
79 | .trim_start_matches(prefix) | 83 | .trim_start_matches(prefix) |
80 | .trim_start(); | 84 | .trim_start(); |
81 | trimmed.to_owned() | 85 | trimmed.to_owned() |
82 | }).join("\n") | 86 | }) |
87 | .join("\n") | ||
83 | } | 88 | } |
84 | } | 89 | } |
85 | 90 | ||
@@ -250,7 +255,6 @@ impl<'a> IfExpr<'a> { | |||
250 | } | 255 | } |
251 | } | 256 | } |
252 | 257 | ||
253 | |||
254 | #[derive(Debug, Clone, Copy)] | 258 | #[derive(Debug, Clone, Copy)] |
255 | pub enum PathSegmentKind<'a> { | 259 | pub enum PathSegmentKind<'a> { |
256 | Name(NameRef<'a>), | 260 | Name(NameRef<'a>), |
@@ -261,7 +265,9 @@ pub enum PathSegmentKind<'a> { | |||
261 | 265 | ||
262 | impl<'a> PathSegment<'a> { | 266 | impl<'a> PathSegment<'a> { |
263 | pub fn parent_path(self) -> Path<'a> { | 267 | pub fn parent_path(self) -> Path<'a> { |
264 | self.syntax().parent().and_then(Path::cast) | 268 | self.syntax() |
269 | .parent() | ||
270 | .and_then(Path::cast) | ||
265 | .expect("segments are always nested in paths") | 271 | .expect("segments are always nested in paths") |
266 | } | 272 | } |
267 | 273 | ||