Address lint.

This commit is contained in:
Bill Thiede 2023-03-19 20:48:39 -07:00
parent 7bfef154d9
commit f5f4d666d5

View File

@ -5,6 +5,7 @@ enum MatchType {
From, From,
Sender, Sender,
To, To,
Cc,
Subject, Subject,
List, List,
DeliveredTo, DeliveredTo,
@ -81,6 +82,11 @@ impl FromStr for Match {
match_type: MatchType::From, match_type: MatchType::From,
needle: cleanup_match(FROM, needle), needle: cleanup_match(FROM, needle),
}); });
} else if needle.starts_with(CC) {
return Ok(Match {
match_type: MatchType::Cc,
needle: cleanup_match(CC, needle),
});
} else if needle.starts_with(TOCC) { } else if needle.starts_with(TOCC) {
return Ok(Match { return Ok(Match {
match_type: MatchType::To, match_type: MatchType::To,
@ -88,7 +94,7 @@ impl FromStr for Match {
}); });
} else if needle.starts_with(SENDER) { } else if needle.starts_with(SENDER) {
return Ok(Match { return Ok(Match {
match_type: MatchType::From, match_type: MatchType::Sender,
needle: cleanup_match(SENDER, needle), needle: cleanup_match(SENDER, needle),
}); });
} else if needle.starts_with(SUBJECT) { } else if needle.starts_with(SUBJECT) {
@ -140,7 +146,6 @@ impl FromStr for Match {
needle: cleanup_match("", &needle), needle: cleanup_match("", &needle),
}); });
} }
Ok(Match::default())
} }
} }
@ -161,6 +166,7 @@ fn notmuch_from_rules<W: Write>(mut w: W, rules: &[Rule]) -> anyhow::Result<()>
// TODO(wathiede): something more specific? // TODO(wathiede): something more specific?
MatchType::Sender => "from:", MatchType::Sender => "from:",
MatchType::To => "to:", MatchType::To => "to:",
MatchType::Cc => "to:",
MatchType::Subject => "subject:", MatchType::Subject => "subject:",
MatchType::List => "List-ID:", MatchType::List => "List-ID:",
MatchType::Body => "", MatchType::Body => "",