format_collect

This commit is contained in:
Johann Hemmann 2024-01-30 14:12:42 +01:00
parent d37f4e0d21
commit 771c6c9271
8 changed files with 54 additions and 39 deletions

View file

@ -11,6 +11,7 @@ use std::{
use ast::HasName;
use expect_test::expect_file;
use rayon::prelude::*;
use stdx::format_to_acc;
use test_utils::{bench, bench_fixture, project_root};
use crate::{ast, fuzz, AstNode, SourceFile, SyntaxError};
@ -104,10 +105,9 @@ fn self_hosting_parsing() {
.collect::<Vec<_>>();
if !errors.is_empty() {
let errors = errors
.into_iter()
.map(|(path, err)| format!("{}: {:?}\n", path.display(), err[0]))
.collect::<String>();
let errors = errors.into_iter().fold(String::new(), |mut acc, (path, err)| {
format_to_acc!(acc, "{}: {:?}\n", path.display(), err[0])
});
panic!("Parsing errors:\n{errors}\n");
}
}