@@ -254,7 +254,7 @@ impl GlobalState {
254254
255255 pub ( crate ) fn process_changes ( & mut self ) -> bool {
256256 let _p = span ! ( Level :: INFO , "GlobalState::process_changes" ) . entered ( ) ;
257- let mut file_changes = FxHashMap :: < _ , ( bool , ChangedFile ) > :: default ( ) ;
257+ let mut file_changes = FxHashMap :: < _ , ChangedFile > :: default ( ) ;
258258 let ( change, modified_rust_files, workspace_structure_change) = {
259259 let mut change = ChangeWithProcMacros :: new ( ) ;
260260 let mut guard = self . vfs . write ( ) ;
@@ -263,8 +263,6 @@ impl GlobalState {
263263 return false ;
264264 }
265265
266- let _p =
267- span ! ( Level :: INFO , "GlobalState::process_changes/gather_changed_files" ) . entered ( ) ;
268266 // downgrade to read lock to allow more readers while we are normalizing text
269267 let guard = RwLockWriteGuard :: downgrade_to_upgradable ( guard) ;
270268 let vfs: & Vfs = & guard. 0 ;
@@ -275,53 +273,40 @@ impl GlobalState {
275273 use vfs:: Change :: * ;
276274 match file_changes. entry ( changed_file. file_id ) {
277275 Entry :: Occupied ( mut o) => {
278- let ( just_created , change) = o. get_mut ( ) ;
279- match ( & mut change. change , just_created , changed_file. change ) {
276+ let change = o. get_mut ( ) ;
277+ match ( & mut change. change , changed_file. change ) {
280278 // latter `Delete` wins
281- ( change, _ , Delete ) => * change = Delete ,
279+ ( change, Delete ) => * change = Delete ,
282280 // merge `Create` with `Create` or `Modify`
283- ( Create ( prev) , _ , Create ( new) | Modify ( new) ) => * prev = new,
281+ ( Create ( prev) , Create ( new) | Modify ( new) ) => * prev = new,
284282 // collapse identical `Modify`es
285- ( Modify ( prev) , _ , Modify ( new) ) => * prev = new,
283+ ( Modify ( prev) , Modify ( new) ) => * prev = new,
286284 // equivalent to `Modify`
287- ( change @ Delete , just_created , Create ( new) ) => {
285+ ( change @ Delete , Create ( new) ) => {
288286 * change = Modify ( new) ;
289- * just_created = true ;
290287 }
291288 // shouldn't occur, but collapse into `Create`
292- ( change @ Delete , just_created, Modify ( new) ) => {
289+ ( change @ Delete , Modify ( new) ) => {
290+ stdx:: never!( ) ;
293291 * change = Create ( new) ;
294- * just_created = true ;
295292 }
296293 // shouldn't occur, but keep the Create
297- ( prev @ Modify ( _) , _ , new @ Create ( _) ) => * prev = new,
294+ ( prev @ Modify ( _) , new @ Create ( _) ) => * prev = new,
298295 }
299296 }
300- Entry :: Vacant ( v) => {
301- _ = v. insert ( ( matches ! ( & changed_file. change, Create ( _) ) , changed_file) )
302- }
297+ Entry :: Vacant ( v) => _ = v. insert ( changed_file) ,
303298 }
304299 }
305300
306- let _p = span ! ( Level :: INFO , "GlobalState::process_changes/calculate_changed_files" )
307- . entered ( ) ;
308- let changed_files: Vec < _ > = file_changes
309- . into_iter ( )
310- . filter ( |( _, ( just_created, change) ) | {
311- !( * just_created && matches ! ( change. change, vfs:: Change :: Delete ) )
312- } )
313- . map ( |( file_id, ( _, change) ) | vfs:: ChangedFile { file_id, ..change } )
314- . collect ( ) ;
315-
316301 let mut workspace_structure_change = None ;
317302 // A file was added or deleted
318303 let mut has_structure_changes = false ;
319304 let mut bytes = vec ! [ ] ;
320305 let mut modified_rust_files = vec ! [ ] ;
321- for file in changed_files {
306+ for file in file_changes . into_values ( ) {
322307 let vfs_path = vfs. file_path ( file. file_id ) ;
323308 if let Some ( path) = vfs_path. as_path ( ) {
324- has_structure_changes = file. is_created_or_deleted ( ) ;
309+ has_structure_changes | = file. is_created_or_deleted ( ) ;
325310
326311 if file. is_modified ( ) && path. extension ( ) == Some ( "rs" ) {
327312 modified_rust_files. push ( file. file_id ) ;
0 commit comments