@@ -337,12 +337,15 @@ impl flags::AnalysisStats {
337337 }
338338 } ) ;
339339
340+ file_ids. sort ( ) ;
341+ file_ids. dedup ( ) ;
342+
340343 if self . run_all_ide_things {
341- self . run_ide_things ( host. analysis ( ) , file_ids. clone ( ) , db, & vfs, verbosity) ;
344+ self . run_ide_things ( host. analysis ( ) , & file_ids, db, & vfs, verbosity) ;
342345 }
343346
344347 if self . run_term_search {
345- self . run_term_search ( & workspace, db, & vfs, file_ids, verbosity) ;
348+ self . run_term_search ( & workspace, db, & vfs, & file_ids, verbosity) ;
346349 }
347350
348351 let db = host. raw_database_mut ( ) ;
@@ -438,12 +441,13 @@ impl flags::AnalysisStats {
438441 report_metric ( "const eval time" , const_eval_time. time . as_millis ( ) as u64 , "ms" ) ;
439442 }
440443
444+ /// Invariant: `file_ids` must be sorted and deduped before passing into here
441445 fn run_term_search (
442446 & self ,
443447 ws : & ProjectWorkspace ,
444448 db : & RootDatabase ,
445449 vfs : & Vfs ,
446- mut file_ids : Vec < EditionedFileId > ,
450+ file_ids : & [ EditionedFileId ] ,
447451 verbosity : Verbosity ,
448452 ) {
449453 let cargo_config = CargoConfig {
@@ -461,9 +465,6 @@ impl flags::AnalysisStats {
461465 _ => ProgressReport :: new ( file_ids. len ( ) ) ,
462466 } ;
463467
464- file_ids. sort ( ) ;
465- file_ids. dedup ( ) ;
466-
467468 #[ derive( Debug , Default ) ]
468469 struct Acc {
469470 tail_expr_syntax_hits : u64 ,
@@ -477,7 +478,7 @@ impl flags::AnalysisStats {
477478 bar. tick ( ) ;
478479 let mut sw = self . stop_watch ( ) ;
479480
480- for & file_id in & file_ids {
481+ for & file_id in file_ids {
481482 let file_id = file_id. editioned_file_id ( db) ;
482483 let sema = hir:: Semantics :: new ( db) ;
483484 let display_target = match sema. first_crate ( file_id. file_id ( ) ) {
@@ -1109,10 +1110,11 @@ impl flags::AnalysisStats {
11091110 report_metric ( "body lowering time" , body_lowering_time. time . as_millis ( ) as u64 , "ms" ) ;
11101111 }
11111112
1113+ /// Invariant: `file_ids` must be sorted and deduped before passing into here
11121114 fn run_ide_things (
11131115 & self ,
11141116 analysis : Analysis ,
1115- mut file_ids : Vec < EditionedFileId > ,
1117+ file_ids : & [ EditionedFileId ] ,
11161118 db : & RootDatabase ,
11171119 vfs : & Vfs ,
11181120 verbosity : Verbosity ,
@@ -1124,12 +1126,10 @@ impl flags::AnalysisStats {
11241126 _ => ProgressReport :: new ( len) ,
11251127 } ;
11261128
1127- file_ids. sort ( ) ;
1128- file_ids. dedup ( ) ;
11291129 let mut sw = self . stop_watch ( ) ;
11301130
11311131 let mut bar = create_bar ( ) ;
1132- for & file_id in & file_ids {
1132+ for & file_id in file_ids {
11331133 let msg = format ! ( "diagnostics: {}" , vfs. file_path( file_id. file_id( db) ) ) ;
11341134 bar. set_message ( move || msg. clone ( ) ) ;
11351135 _ = analysis. full_diagnostics (
@@ -1163,7 +1163,7 @@ impl flags::AnalysisStats {
11631163 bar. finish_and_clear ( ) ;
11641164
11651165 let mut bar = create_bar ( ) ;
1166- for & file_id in & file_ids {
1166+ for & file_id in file_ids {
11671167 let msg = format ! ( "inlay hints: {}" , vfs. file_path( file_id. file_id( db) ) ) ;
11681168 bar. set_message ( move || msg. clone ( ) ) ;
11691169 _ = analysis. inlay_hints (
@@ -1206,7 +1206,7 @@ impl flags::AnalysisStats {
12061206 bar. finish_and_clear ( ) ;
12071207
12081208 let mut bar = create_bar ( ) ;
1209- for & file_id in & file_ids {
1209+ for & file_id in file_ids {
12101210 let msg = format ! ( "annotations: {}" , vfs. file_path( file_id. file_id( db) ) ) ;
12111211 bar. set_message ( move || msg. clone ( ) ) ;
12121212 analysis
0 commit comments