~savoy/mailcap

0e054697ba3b050aa256f89b44a5043040559eae — savoy 2 years ago 53909a0
bug: proper None handling when creating HashMap

Signed-off-by: savoy <git@liberation.red>
1 files changed, 4 insertions(+), 1 deletions(-)

M src/lib.rs
M src/lib.rs => src/lib.rs +4 -1
@@ 78,7 78,10 @@ impl Mailcap {
        let parsed_lines = Self::parse_valid_lines(virgin_lines)?;
        let data: HashMap<String, Entry> = parsed_lines
            .iter()
            .filter_map(|i| Some((i[0].to_owned(), Entry::from(i).unwrap())))
            .filter_map(|i| match Entry::from(i) {
                Some(m) => Some((i[0].to_owned(), m)),
                None => None,
            })
            .collect();

        Ok(Mailcap { files, data })