Skip to content

Commit b7eb36a

Browse files
committed
Write errors without allocations
1 parent 5e3d146 commit b7eb36a

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

juniper/src/lib.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -194,13 +194,10 @@ impl<'a> fmt::Display for GraphQLError<'a> {
194194
match self {
195195
GraphQLError::ParseError(error) => write!(f, "{}", error),
196196
GraphQLError::ValidationError(errors) => {
197-
let msgs = errors
198-
.iter()
199-
.map(|error| format!("{}", error))
200-
.collect::<Vec<_>>()
201-
.join("\n");
202-
203-
write!(f, "{}", msgs)
197+
for error in errors {
198+
writeln!(f, "{}", error)?;
199+
}
200+
Ok(())
204201
}
205202
GraphQLError::NoOperationProvided => write!(f, "No operation provided"),
206203
GraphQLError::MultipleOperationsProvided => write!(f, "Multiple operations provided"),

0 commit comments

Comments
 (0)