From c7bd41d1601224bdfc2b065d126f4aa68bc7eeb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20M=C3=BCller?= Date: Mon, 20 Nov 2023 12:30:19 +0100 Subject: [PATCH] Use `IO.copy` in `IO#gets_to_end` (#13990) --- src/io.cr | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/io.cr b/src/io.cr index 28a3652c9e4c..c159c77776b5 100644 --- a/src/io.cr +++ b/src/io.cr @@ -563,10 +563,7 @@ abstract class IO decoder.write(str) end else - buffer = uninitialized UInt8[DEFAULT_BUFFER_SIZE] - while (read_bytes = read(buffer.to_slice)) > 0 - str.write buffer.to_slice[0, read_bytes] - end + IO.copy(self, str) end end end