@@ -337,12 +337,15 @@ impl flags::AnalysisStats {
337
337
}
338
338
} ) ;
339
339
340
+ file_ids. sort ( ) ;
341
+ file_ids. dedup ( ) ;
342
+
340
343
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) ;
342
345
}
343
346
344
347
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) ;
346
349
}
347
350
348
351
let db = host. raw_database_mut ( ) ;
@@ -438,12 +441,13 @@ impl flags::AnalysisStats {
438
441
report_metric ( "const eval time" , const_eval_time. time . as_millis ( ) as u64 , "ms" ) ;
439
442
}
440
443
444
+ /// Invariant: `file_ids` must be sorted and deduped before passing into here
441
445
fn run_term_search (
442
446
& self ,
443
447
ws : & ProjectWorkspace ,
444
448
db : & RootDatabase ,
445
449
vfs : & Vfs ,
446
- mut file_ids : Vec < EditionedFileId > ,
450
+ file_ids : & [ EditionedFileId ] ,
447
451
verbosity : Verbosity ,
448
452
) {
449
453
let cargo_config = CargoConfig {
@@ -461,9 +465,6 @@ impl flags::AnalysisStats {
461
465
_ => ProgressReport :: new ( file_ids. len ( ) ) ,
462
466
} ;
463
467
464
- file_ids. sort ( ) ;
465
- file_ids. dedup ( ) ;
466
-
467
468
#[ derive( Debug , Default ) ]
468
469
struct Acc {
469
470
tail_expr_syntax_hits : u64 ,
@@ -477,7 +478,7 @@ impl flags::AnalysisStats {
477
478
bar. tick ( ) ;
478
479
let mut sw = self . stop_watch ( ) ;
479
480
480
- for & file_id in & file_ids {
481
+ for & file_id in file_ids {
481
482
let file_id = file_id. editioned_file_id ( db) ;
482
483
let sema = hir:: Semantics :: new ( db) ;
483
484
let display_target = match sema. first_crate ( file_id. file_id ( ) ) {
@@ -1109,10 +1110,11 @@ impl flags::AnalysisStats {
1109
1110
report_metric ( "body lowering time" , body_lowering_time. time . as_millis ( ) as u64 , "ms" ) ;
1110
1111
}
1111
1112
1113
+ /// Invariant: `file_ids` must be sorted and deduped before passing into here
1112
1114
fn run_ide_things (
1113
1115
& self ,
1114
1116
analysis : Analysis ,
1115
- mut file_ids : Vec < EditionedFileId > ,
1117
+ file_ids : & [ EditionedFileId ] ,
1116
1118
db : & RootDatabase ,
1117
1119
vfs : & Vfs ,
1118
1120
verbosity : Verbosity ,
@@ -1124,12 +1126,10 @@ impl flags::AnalysisStats {
1124
1126
_ => ProgressReport :: new ( len) ,
1125
1127
} ;
1126
1128
1127
- file_ids. sort ( ) ;
1128
- file_ids. dedup ( ) ;
1129
1129
let mut sw = self . stop_watch ( ) ;
1130
1130
1131
1131
let mut bar = create_bar ( ) ;
1132
- for & file_id in & file_ids {
1132
+ for & file_id in file_ids {
1133
1133
let msg = format ! ( "diagnostics: {}" , vfs. file_path( file_id. file_id( db) ) ) ;
1134
1134
bar. set_message ( move || msg. clone ( ) ) ;
1135
1135
_ = analysis. full_diagnostics (
@@ -1163,7 +1163,7 @@ impl flags::AnalysisStats {
1163
1163
bar. finish_and_clear ( ) ;
1164
1164
1165
1165
let mut bar = create_bar ( ) ;
1166
- for & file_id in & file_ids {
1166
+ for & file_id in file_ids {
1167
1167
let msg = format ! ( "inlay hints: {}" , vfs. file_path( file_id. file_id( db) ) ) ;
1168
1168
bar. set_message ( move || msg. clone ( ) ) ;
1169
1169
_ = analysis. inlay_hints (
@@ -1206,7 +1206,7 @@ impl flags::AnalysisStats {
1206
1206
bar. finish_and_clear ( ) ;
1207
1207
1208
1208
let mut bar = create_bar ( ) ;
1209
- for & file_id in & file_ids {
1209
+ for & file_id in file_ids {
1210
1210
let msg = format ! ( "annotations: {}" , vfs. file_path( file_id. file_id( db) ) ) ;
1211
1211
bar. set_message ( move || msg. clone ( ) ) ;
1212
1212
analysis
0 commit comments