1
0
Fork 0

remove usage of BufReader

This commit is contained in:
Simon Renblad 2024-10-04 13:31:04 +08:00
parent cbf2efb1cb
commit db80ec798b
1 changed files with 4 additions and 2 deletions

View File

@ -57,8 +57,10 @@ fn parse_config<'a>(
file: fatfs::File<sd_reader::SdReader>,
) -> 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(());