mirror of
https://github.com/chatmail/core.git
synced 2026-05-23 00:36:32 +03:00
skip_forward_header: get rid of indexing with subslice patterns
This commit is contained in:
committed by
Alexander Krotov
parent
1c21d4f356
commit
d997bbc081
@@ -67,14 +67,13 @@ pub fn simplify(mut input: String, is_chat_message: bool) -> (String, bool) {
|
|||||||
/// Returns message body lines and a boolean indicating whether
|
/// Returns message body lines and a boolean indicating whether
|
||||||
/// a message is forwarded or not.
|
/// a message is forwarded or not.
|
||||||
fn skip_forward_header<'a>(lines: &'a [&str]) -> (&'a [&'a str], bool) {
|
fn skip_forward_header<'a>(lines: &'a [&str]) -> (&'a [&'a str], bool) {
|
||||||
if lines.len() >= 3
|
match lines {
|
||||||
&& lines[0] == "---------- Forwarded message ----------"
|
["---------- Forwarded message ----------", first_line, "", rest @ ..]
|
||||||
&& lines[1].starts_with("From: ")
|
if first_line.starts_with("From: ") =>
|
||||||
&& lines[2].is_empty()
|
{
|
||||||
{
|
(rest, true)
|
||||||
(&lines[3..], true)
|
}
|
||||||
} else {
|
_ => (lines, false),
|
||||||
(lines, false)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user