diff options
| author | Teddy Wing | 2016-04-24 05:17:19 -0400 | 
|---|---|---|
| committer | Teddy Wing | 2016-04-24 05:17:19 -0400 | 
| commit | 2d1f7031f03194fbceffc15b1d6376abea243e22 (patch) | |
| tree | 29481b3837f6363f6405ac15e82b07b4cb89f773 /src/alias.rs | |
| parent | c67fdff0c3cda883b5bf577988e1c555931969cf (diff) | |
| download | mutt-alias-auto-add-2d1f7031f03194fbceffc15b1d6376abea243e22.tar.bz2 | |
Move `write_alias` function to `Alias#write_to_file`
Expand the responsibility of `Alias#write_to_file` so that it performs
what it used to do plus all of what `write_alias` did.
This allows us to consolidate the functionality into a single method,
and move it into the `Alias` implementation.
The change required some modification to our `write_to_file` test:
* Create our test alias as mutable
* Write a new alias to the test file based on our test alias but with a
  different email. This allows the `write_to_file` method to work
  without erroring with an `AliasSearchError::NotFound`.
* Needed to `derive(Clone)` on `Alias` in order to be able to easily
  clone it into the new near-duplicate alias.
* Change our `unwrap()` calls to `expect()` to make it easier to see
  where exactly we panicked. Otherwise I didn't really have any way of
  knowing.
* Add some comments for clarity
Diffstat (limited to 'src/alias.rs')
0 files changed, 0 insertions, 0 deletions
