mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-04 11:34:51 +00:00
Fix divide by zero
This commit is contained in:
parent
d4dc3ca83b
commit
2ced362e57
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
fmt,
|
fmt,
|
||||||
|
ops::Div as _,
|
||||||
time::{Duration, Instant},
|
time::{Duration, Instant},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -499,7 +500,7 @@ impl GlobalState {
|
|||||||
tracing::trace!("updating notifications for {:?}", subscriptions);
|
tracing::trace!("updating notifications for {:?}", subscriptions);
|
||||||
// Split up the work on multiple threads, but we don't wanna fill the entire task pool with
|
// Split up the work on multiple threads, but we don't wanna fill the entire task pool with
|
||||||
// diagnostic tasks, so we limit the number of tasks to a quarter of the total thread pool.
|
// diagnostic tasks, so we limit the number of tasks to a quarter of the total thread pool.
|
||||||
let max_tasks = self.config.main_loop_num_threads() / 4;
|
let max_tasks = self.config.main_loop_num_threads().div(4).max(1);
|
||||||
let chunk_length = subscriptions.len() / max_tasks;
|
let chunk_length = subscriptions.len() / max_tasks;
|
||||||
let remainder = subscriptions.len() % max_tasks;
|
let remainder = subscriptions.len() % max_tasks;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user