From 8ee2926aa2be9ac0e658386b91617e6563cc5d71 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 12 May 2019 20:55:17 +0300 Subject: drop obsolete render test subcommand --- crates/ra_cli/src/main.rs | 31 +------------------------------ 1 file changed, 1 insertion(+), 30 deletions(-) (limited to 'crates') diff --git a/crates/ra_cli/src/main.rs b/crates/ra_cli/src/main.rs index 5a8136823..038f5f3fe 100644 --- a/crates/ra_cli/src/main.rs +++ b/crates/ra_cli/src/main.rs @@ -1,11 +1,10 @@ mod analysis_stats; -use std::{fs, io::Read, path::Path}; +use std::io::Read; use clap::{App, Arg, SubCommand}; use ra_ide_api::file_structure; use ra_syntax::{SourceFile, TreeArc, AstNode}; -use tools::collect_tests; use flexi_logger::Logger; use ra_prof::profile; @@ -15,11 +14,6 @@ fn main() -> Result<()> { Logger::with_env().start()?; let matches = App::new("ra-cli") .setting(clap::AppSettings::SubcommandRequiredElseHelp) - .subcommand( - SubCommand::with_name("render-test") - .arg(Arg::with_name("line").long("--line").required(true).takes_value(true)) - .arg(Arg::with_name("file").long("--file").required(true).takes_value(true)), - ) .subcommand(SubCommand::with_name("parse").arg(Arg::with_name("no-dump").long("--no-dump"))) .subcommand(SubCommand::with_name("symbols")) .subcommand( @@ -44,14 +38,6 @@ fn main() -> Result<()> { println!("{:?}", s); } } - ("render-test", Some(matches)) => { - let file = matches.value_of("file").unwrap(); - let file = Path::new(file); - let line: usize = matches.value_of("line").unwrap().parse()?; - let line = line - 1; - let (test, tree) = render_test(file, line)?; - println!("{}\n{}", test, tree); - } ("analysis-stats", Some(matches)) => { let verbose = matches.is_present("verbose"); let path = matches.value_of("path").unwrap_or(""); @@ -73,18 +59,3 @@ fn read_stdin() -> Result { ::std::io::stdin().read_to_string(&mut buff)?; Ok(buff) } - -fn render_test(file: &Path, line: usize) -> Result<(String, String)> { - let text = fs::read_to_string(file)?; - let tests = collect_tests(&text); - let test = tests.into_iter().find(|(start_line, t)| { - *start_line <= line && line <= *start_line + t.text.lines().count() - }); - let test = match test { - None => failure::bail!("No test found at line {} at {}", line, file.display()), - Some((_start_line, test)) => test, - }; - let file = SourceFile::parse(&test.text); - let tree = file.syntax().debug_dump(); - Ok((test.text, tree)) -} -- cgit v1.2.3