2916: Buffer reads from cargo check's stdout r=matklad a=lnicola

`Stdio::piped()` is unbuffered, which caused RA to read the output of `cargo check` one byte at a time (out of 114KB in my test).

This isn't obviously faster on my system, but making fewer syscalls sounds like a good idea.

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
This commit is contained in:
bors[bot] 2020-01-27 23:33:06 +00:00 committed by GitHub
commit 912776fd95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,6 +9,7 @@ use lsp_types::{
};
use std::{
collections::HashMap,
io::BufReader,
path::PathBuf,
process::{Command, Stdio},
sync::Arc,
@ -347,7 +348,9 @@ impl WatchThread {
// which will break out of the loop, and continue the shutdown
let _ = message_send.send(CheckEvent::Begin);
for message in cargo_metadata::parse_messages(command.stdout.take().unwrap()) {
for message in
cargo_metadata::parse_messages(BufReader::new(command.stdout.take().unwrap()))
{
let message = match message {
Ok(message) => message,
Err(err) => {