@@ -4,8 +4,6 @@ use log::info;
44use ra_ap_ide_db:: line_index:: { LineCol , LineIndex } ;
55use ra_ap_project_model:: ProjectManifest ;
66use rust_analyzer:: { ParseResult , RustAnalyzer } ;
7- use std:: fs:: File ;
8- use std:: io:: { BufRead , BufReader } ;
97use std:: {
108 collections:: HashMap ,
119 path:: { Path , PathBuf } ,
@@ -69,15 +67,16 @@ fn extract(
6967 } ) ;
7068}
7169
72- fn run_extractor ( mut cfg : config:: Config ) -> anyhow:: Result < ( ) > {
70+ fn main ( ) -> anyhow:: Result < ( ) > {
71+ let mut cfg = config:: Config :: extract ( ) . context ( "failed to load configuration" ) ?;
7372 stderrlog:: new ( )
7473 . module ( module_path ! ( ) )
75- . verbosity ( cfg. verbose as usize )
74+ . verbosity ( 2 + cfg. verbose as usize )
7675 . init ( ) ?;
7776 if cfg. qltest {
7877 qltest:: prepare ( & mut cfg) ?;
7978 }
80- info ! ( "configuration: {cfg:#?}\n " ) ;
79+ info ! ( "{cfg:#?}\n " ) ;
8180
8281 let traps = trap:: TrapFileProvider :: new ( & cfg) . context ( "failed to set up trap files" ) ?;
8382 let archiver = archive:: Archiver {
@@ -125,19 +124,3 @@ fn run_extractor(mut cfg: config::Config) -> anyhow::Result<()> {
125124
126125 Ok ( ( ) )
127126}
128-
129- fn main ( ) -> anyhow:: Result < ( ) > {
130- let cfg = config:: Config :: extract ( ) . context ( "failed to load configuration" ) ?;
131- let qltest = cfg. qltest ;
132- let qltest_log = cfg. log_dir . join ( "qltest.log" ) ;
133- let result = std:: panic:: catch_unwind ( || run_extractor ( cfg) ) ;
134- if qltest && matches ! ( result, Err ( _) | Ok ( Err ( _) ) ) {
135- // in case of failure, print out the full log
136- let log = File :: open ( qltest_log) . context ( "opening qltest.log" ) ?;
137- let reader = BufReader :: new ( log) ;
138- for line in reader. lines ( ) {
139- println ! ( "{}" , line. context( "reading qltest.log" ) ?) ;
140- }
141- }
142- result. unwrap ( )
143- }
0 commit comments