Skip to content

Commit 9970dd3

Browse files
committed
Simplify
1 parent e83a291 commit 9970dd3

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

crates/rust-analyzer/src/main_loop.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,6 @@ pub fn main_loop(ws_roots: Vec<PathBuf>, config: Config, connection: Connection)
173173
};
174174

175175
loop_state.roots_total = world_state.vfs.read().n_roots();
176-
loop_state.roots_scanned = 0;
177176

178177
let pool = ThreadPool::default();
179178
let (task_sender, task_receiver) = unbounded::<Task>();
@@ -400,10 +399,12 @@ fn loop_turn(
400399
}
401400

402401
let max_in_flight_libs = pool.max_count().saturating_sub(2).max(1);
403-
while loop_state.in_flight_libraries < max_in_flight_libs
404-
&& !loop_state.pending_libraries.is_empty()
405-
{
406-
let (root, files) = loop_state.pending_libraries.pop().unwrap();
402+
while loop_state.in_flight_libraries < max_in_flight_libs {
403+
let (root, files) = match loop_state.pending_libraries.pop() {
404+
Some(it) => it,
405+
None => break,
406+
};
407+
407408
loop_state.in_flight_libraries += 1;
408409
let sender = libdata_sender.clone();
409410
pool.execute(move || {

0 commit comments

Comments
 (0)