From bc8b5bb362160b997989950f33ebc15dfb421483 Mon Sep 17 00:00:00 2001 From: Simon Renblad Date: Fri, 4 Oct 2024 13:31:04 +0800 Subject: [PATCH] remove usage of BufReader --- libconfig/src/lib.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libconfig/src/lib.rs b/libconfig/src/lib.rs index f1bf1b1..50cb34b 100644 --- a/libconfig/src/lib.rs +++ b/libconfig/src/lib.rs @@ -57,8 +57,10 @@ fn parse_config<'a>( file: fatfs::File, ) -> Result<'a, ()> { let prefix = [key, "="].concat().to_ascii_lowercase(); - for line in BufReader::new(file).lines() { - let line = line?.to_ascii_lowercase(); + let mut read_buffer = String::new(); + file.read_to_string(&mut read_buffer); + for line in read_buffer.lines() { + let line = line.to_ascii_lowercase(); if line.starts_with(&prefix) { buffer.extend(line[prefix.len()..].as_bytes()); return Ok(());