Skip to content

Commit 4b5a190

Browse files
author
fupan.lfp
committed
freezer: fix the issue of missing trim the str
When reading from the freezer file, it should trim it first, and the string may container an '\n'. Fixes: #48 Signed-off-by: fupan.lfp <[email protected]>
1 parent 45b626e commit 4b5a190

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: src/freezer.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ impl FreezerController {
130130
let mut s = String::new();
131131
let res = file.read_to_string(&mut s);
132132
match res {
133-
Ok(_) => match s.as_ref() {
133+
Ok(_) => match s.trim() {
134134
"FROZEN" => Ok(FreezerState::Frozen),
135135
"THAWED" => Ok(FreezerState::Thawed),
136136
"1" => Ok(FreezerState::Frozen),

0 commit comments

Comments
 (0)