Skip to content

Commit fb63457

Browse files
committed
Remove default case and return error instead
1 parent 25f96b3 commit fb63457

1 file changed

Lines changed: 5 additions & 12 deletions

File tree

aggregation_mode/src/backend/config.rs

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,11 @@ impl Config {
3333
}
3434

3535
pub fn get_last_aggregated_block(&self) -> Result<u64, Box<dyn std::error::Error>> {
36-
match File::open(&self.last_aggregated_block_filepath) {
37-
Err(_) => {
38-
// if file doesn't exist, default 0
39-
Ok(0)
40-
}
41-
Ok(mut file) => {
42-
let mut contents = String::new();
43-
file.read_to_string(&mut contents)?;
44-
let lpb: LastAggregatedBlock = serde_json::from_str(&contents)?;
45-
Ok(lpb.last_aggregated_block)
46-
}
47-
}
36+
let mut file = File::open(&self.last_aggregated_block_filepath)?;
37+
let mut contents = String::new();
38+
file.read_to_string(&mut contents)?;
39+
let lpb: LastAggregatedBlock = serde_json::from_str(&contents)?;
40+
Ok(lpb.last_aggregated_block)
4841
}
4942

5043
pub fn update_last_aggregated_block(

0 commit comments

Comments
 (0)