diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-01-08 09:05:55 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-01-08 09:05:55 +0000 |
commit | 3f4be819125ce4a22edd86721fa56b5caba99c2e (patch) | |
tree | be93895ddc08c911585d9f7bc64623a3741f32c6 /crates/ra_cli | |
parent | 4e444d2bc24d16284401444fd2154f63e0f96070 (diff) | |
parent | 122410d7aa34a32d468a3173858cbc8a2bbc68f5 (diff) |
Merge #449
449: switch to new rowan API r=matklad a=matklad
closes https://github.com/rust-analyzer/rust-analyzer/issues/448
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_cli')
-rw-r--r-- | crates/ra_cli/src/main.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/crates/ra_cli/src/main.rs b/crates/ra_cli/src/main.rs index a3b856aa9..0d12f3a88 100644 --- a/crates/ra_cli/src/main.rs +++ b/crates/ra_cli/src/main.rs | |||
@@ -3,7 +3,7 @@ use std::{fs, io::Read, path::Path, time::Instant}; | |||
3 | use clap::{App, Arg, SubCommand}; | 3 | use clap::{App, Arg, SubCommand}; |
4 | use join_to_string::join; | 4 | use join_to_string::join; |
5 | use ra_editor::{extend_selection, file_structure, syntax_tree}; | 5 | use ra_editor::{extend_selection, file_structure, syntax_tree}; |
6 | use ra_syntax::{SourceFileNode, TextRange}; | 6 | use ra_syntax::{SourceFile, TextRange, TreePtr, AstNode}; |
7 | use tools::collect_tests; | 7 | use tools::collect_tests; |
8 | 8 | ||
9 | type Result<T> = ::std::result::Result<T, failure::Error>; | 9 | type Result<T> = ::std::result::Result<T, failure::Error>; |
@@ -71,9 +71,9 @@ fn main() -> Result<()> { | |||
71 | Ok(()) | 71 | Ok(()) |
72 | } | 72 | } |
73 | 73 | ||
74 | fn file() -> Result<SourceFileNode> { | 74 | fn file() -> Result<TreePtr<SourceFile>> { |
75 | let text = read_stdin()?; | 75 | let text = read_stdin()?; |
76 | Ok(SourceFileNode::parse(&text)) | 76 | Ok(SourceFile::parse(&text)) |
77 | } | 77 | } |
78 | 78 | ||
79 | fn read_stdin() -> Result<String> { | 79 | fn read_stdin() -> Result<String> { |
@@ -92,12 +92,12 @@ fn render_test(file: &Path, line: usize) -> Result<(String, String)> { | |||
92 | None => failure::bail!("No test found at line {} at {}", line, file.display()), | 92 | None => failure::bail!("No test found at line {} at {}", line, file.display()), |
93 | Some((_start_line, test)) => test, | 93 | Some((_start_line, test)) => test, |
94 | }; | 94 | }; |
95 | let file = SourceFileNode::parse(&test.text); | 95 | let file = SourceFile::parse(&test.text); |
96 | let tree = syntax_tree(&file); | 96 | let tree = syntax_tree(&file); |
97 | Ok((test.text, tree)) | 97 | Ok((test.text, tree)) |
98 | } | 98 | } |
99 | 99 | ||
100 | fn selections(file: &SourceFileNode, start: u32, end: u32) -> String { | 100 | fn selections(file: &SourceFile, start: u32, end: u32) -> String { |
101 | let mut ranges = Vec::new(); | 101 | let mut ranges = Vec::new(); |
102 | let mut cur = Some(TextRange::from_to((start - 1).into(), (end - 1).into())); | 102 | let mut cur = Some(TextRange::from_to((start - 1).into(), (end - 1).into())); |
103 | while let Some(r) = cur { | 103 | while let Some(r) = cur { |