diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-05-29 07:40:39 +0100 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-05-29 07:40:39 +0100 |
commit | 7a1cae59acf72f821343b2ba10ef69fb92a5b952 (patch) | |
tree | 26e606ccd132a24e9bc89cf174e4adadf60c5992 /crates/ra_syntax/src/ast.rs | |
parent | b0d84cb8faefedde7ace4ff152a2a13408e79e5d (diff) | |
parent | 80a17251473bd6213a4c8a51ea7f732394d173c5 (diff) |
Merge #1337
1337: Move syntax errors our of syntax tree r=matklad a=matklad
I am not really sure if it's a good idea, but `SyntaxError` do not really belong to a `SyntaxTree`. So let's just store them on the side?
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_syntax/src/ast.rs')
-rw-r--r-- | crates/ra_syntax/src/ast.rs | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/crates/ra_syntax/src/ast.rs b/crates/ra_syntax/src/ast.rs index f7e33366e..319110b6a 100644 --- a/crates/ra_syntax/src/ast.rs +++ b/crates/ra_syntax/src/ast.rs | |||
@@ -80,7 +80,9 @@ fn test_doc_comment_none() { | |||
80 | // non-doc | 80 | // non-doc |
81 | mod foo {} | 81 | mod foo {} |
82 | "#, | 82 | "#, |
83 | ); | 83 | ) |
84 | .ok() | ||
85 | .unwrap(); | ||
84 | let module = file.syntax().descendants().find_map(Module::cast).unwrap(); | 86 | let module = file.syntax().descendants().find_map(Module::cast).unwrap(); |
85 | assert!(module.doc_comment_text().is_none()); | 87 | assert!(module.doc_comment_text().is_none()); |
86 | } | 88 | } |
@@ -93,7 +95,9 @@ fn test_doc_comment_of_items() { | |||
93 | // non-doc | 95 | // non-doc |
94 | mod foo {} | 96 | mod foo {} |
95 | "#, | 97 | "#, |
96 | ); | 98 | ) |
99 | .ok() | ||
100 | .unwrap(); | ||
97 | let module = file.syntax().descendants().find_map(Module::cast).unwrap(); | 101 | let module = file.syntax().descendants().find_map(Module::cast).unwrap(); |
98 | assert_eq!("doc", module.doc_comment_text().unwrap()); | 102 | assert_eq!("doc", module.doc_comment_text().unwrap()); |
99 | } | 103 | } |
@@ -110,7 +114,9 @@ fn test_doc_comment_preserves_indents() { | |||
110 | /// ``` | 114 | /// ``` |
111 | mod foo {} | 115 | mod foo {} |
112 | "#, | 116 | "#, |
113 | ); | 117 | ) |
118 | .ok() | ||
119 | .unwrap(); | ||
114 | let module = file.syntax().descendants().find_map(Module::cast).unwrap(); | 120 | let module = file.syntax().descendants().find_map(Module::cast).unwrap(); |
115 | assert_eq!("doc1\n```\nfn foo() {\n // ...\n}\n```", module.doc_comment_text().unwrap()); | 121 | assert_eq!("doc1\n```\nfn foo() {\n // ...\n}\n```", module.doc_comment_text().unwrap()); |
116 | } | 122 | } |
@@ -133,7 +139,9 @@ where | |||
133 | for<'a> F: Fn(&'a str) | 139 | for<'a> F: Fn(&'a str) |
134 | {} | 140 | {} |
135 | "#, | 141 | "#, |
136 | ); | 142 | ) |
143 | .ok() | ||
144 | .unwrap(); | ||
137 | let where_clause = file.syntax().descendants().find_map(WhereClause::cast).unwrap(); | 145 | let where_clause = file.syntax().descendants().find_map(WhereClause::cast).unwrap(); |
138 | 146 | ||
139 | let mut predicates = where_clause.predicates(); | 147 | let mut predicates = where_clause.predicates(); |