Skip to content

Commit

Permalink
refactor: Refactor config.rs to pure functional style (starship#427)
Browse files Browse the repository at this point in the history
- Replaced for loop that iterates over mutable state with a fold expression
- Unified the logging for the different accessors. The code is now screaming for further refactoring (get_module_config, get_as_bool, get_as_str, get_as_i64 and get_as_array are basically the same up to higher order functions but I didn't manage to get the life times right)
- Increased test coverage (especially a test case for none not at the end)
- Removed code comments that literally repeated the code in the next line (see e.g. https://blog.usejournal.com/stop-writing-code-comments-28fef5272752)
- Added TODO for the problematic line that swallows the None and produces Some(Style::new()) (this also happened before but in a less obvious way)
  • Loading branch information
Bijan Chokoufe Nejad authored and matchai committed Sep 26, 2019
1 parent caaf3bc commit 34112ef
Showing 1 changed file with 177 additions and 162 deletions.
Loading

0 comments on commit 34112ef

Please sign in to comment.