From 69939392425f160055378f190a65094a96c5cdbc Mon Sep 17 00:00:00 2001 From: Oliver Middleton Date: Thu, 10 Mar 2016 23:59:28 +0000 Subject: Simplify Windows stdout/stderr --- src/libstd/sys/windows/stdio.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/libstd/sys') diff --git a/src/libstd/sys/windows/stdio.rs b/src/libstd/sys/windows/stdio.rs index 190c2571628..a7110044d7f 100644 --- a/src/libstd/sys/windows/stdio.rs +++ b/src/libstd/sys/windows/stdio.rs @@ -69,8 +69,7 @@ fn write(out: &Output, data: &[u8]) -> io::Result { // [1]: https://tahoe-lafs.org/trac/tahoe-lafs/ticket/1232 // [2]: http://www.mail-archive.com/log4net-dev@logging.apache.org/msg00661.html const OUT_MAX: usize = 8192; - let data_len; - let utf16 = match str::from_utf8(data).ok() { + let (utf16, data_len) = match str::from_utf8(data).ok() { Some(mut utf8) => { if utf8.len() > OUT_MAX { let mut new_len = OUT_MAX; @@ -79,8 +78,7 @@ fn write(out: &Output, data: &[u8]) -> io::Result { } utf8 = &utf8[..new_len]; } - data_len = utf8.len(); - utf8.encode_utf16().collect::>() + (utf8.encode_utf16().collect::>(), utf8.len()) } None => return Err(invalid_encoding()), }; -- cgit 1.4.1-3-g733a5