Not really an improvement, but instead of having a separate declaration, you could have 

```let line_count = match obsolete...```

Might be worth trying to make line_count not be mutable.