mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-22 11:32:27 +00:00
Compute total_problems rather than asking for it
This commit is contained in:
parent
97f252c68b
commit
eb135637ef
4 changed files with 11 additions and 21 deletions
|
@ -46,13 +46,12 @@ impl Problems {
|
|||
1 => "warning",
|
||||
_ => "warnings",
|
||||
},
|
||||
total_time.as_millis(),
|
||||
total_time.as_millis()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn report_problems(
|
||||
total_problems: usize,
|
||||
sources: &MutMap<ModuleId, (PathBuf, Box<str>)>,
|
||||
interns: &Interns,
|
||||
can_problems: &mut MutMap<ModuleId, Vec<roc_problem::can::Problem>>,
|
||||
|
@ -60,7 +59,17 @@ pub fn report_problems(
|
|||
) -> Problems {
|
||||
use crate::report::{can_problem, type_problem, Report, RocDocAllocator, DEFAULT_PALETTE};
|
||||
use roc_problem::Severity::*;
|
||||
|
||||
let palette = DEFAULT_PALETTE;
|
||||
let mut total_problems = 0;
|
||||
|
||||
for problems in can_problems.values() {
|
||||
total_problems += problems.len();
|
||||
}
|
||||
|
||||
for problems in type_problems.values() {
|
||||
total_problems += problems.len();
|
||||
}
|
||||
|
||||
// This will often over-allocate total memory, but it means we definitely
|
||||
// never need to re-allocate either the warnings or the errors vec!
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue