config: remove unnecessary mut

This commit is contained in:
Sebastien Bourdeauducq 2020-07-06 11:42:43 +08:00
parent cd12ebf9e9
commit e207c073ee
1 changed files with 2 additions and 2 deletions

View File

@ -77,7 +77,7 @@ impl Config {
Ok(Config { fs }) Ok(Config { fs })
} }
fn read<'b>(&mut self, key: &'b str) -> Result<'b, Vec<u8>> { fn read<'b>(&self, key: &'b str) -> Result<'b, Vec<u8>> {
let root_dir = self.fs.root_dir(); let root_dir = self.fs.root_dir();
let mut buffer: Vec<u8> = Vec::new(); let mut buffer: Vec<u8> = Vec::new();
match root_dir.open_file(&["/CONFIG/", key, ".BIN"].concat()) { match root_dir.open_file(&["/CONFIG/", key, ".BIN"].concat()) {
@ -90,7 +90,7 @@ impl Config {
Ok(buffer) Ok(buffer)
} }
pub fn read_str<'b>(&mut self, key: &'b str) -> Result<'b, String> { pub fn read_str<'b>(&self, key: &'b str) -> Result<'b, String> {
Ok(String::from_utf8(self.read(key)?)?) Ok(String::from_utf8(self.read(key)?)?)
} }
} }