aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_cli
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-01-08 09:05:55 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-01-08 09:05:55 +0000
commit3f4be819125ce4a22edd86721fa56b5caba99c2e (patch)
treebe93895ddc08c911585d9f7bc64623a3741f32c6 /crates/ra_cli
parent4e444d2bc24d16284401444fd2154f63e0f96070 (diff)
parent122410d7aa34a32d468a3173858cbc8a2bbc68f5 (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.rs10
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};
3use clap::{App, Arg, SubCommand}; 3use clap::{App, Arg, SubCommand};
4use join_to_string::join; 4use join_to_string::join;
5use ra_editor::{extend_selection, file_structure, syntax_tree}; 5use ra_editor::{extend_selection, file_structure, syntax_tree};
6use ra_syntax::{SourceFileNode, TextRange}; 6use ra_syntax::{SourceFile, TextRange, TreePtr, AstNode};
7use tools::collect_tests; 7use tools::collect_tests;
8 8
9type Result<T> = ::std::result::Result<T, failure::Error>; 9type Result<T> = ::std::result::Result<T, failure::Error>;
@@ -71,9 +71,9 @@ fn main() -> Result<()> {
71 Ok(()) 71 Ok(())
72} 72}
73 73
74fn file() -> Result<SourceFileNode> { 74fn 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
79fn read_stdin() -> Result<String> { 79fn 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
100fn selections(file: &SourceFileNode, start: u32, end: u32) -> String { 100fn 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 {