mirror of
https://github.com/chatmail/core.git
synced 2026-05-20 15:26:30 +03:00
refactor: get rid of slicing in remove_top_quote
This commit is contained in:
@@ -218,7 +218,6 @@ fn remove_bottom_quote<'a>(lines: &'a [&str]) -> (&'a [&'a str], Option<String>)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::indexing_slicing)]
|
|
||||||
fn remove_top_quote<'a>(
|
fn remove_top_quote<'a>(
|
||||||
lines: &'a [&str],
|
lines: &'a [&str],
|
||||||
is_chat_message: bool,
|
is_chat_message: bool,
|
||||||
@@ -245,10 +244,12 @@ fn remove_top_quote<'a>(
|
|||||||
}
|
}
|
||||||
if let Some(last_quoted_line) = last_quoted_line {
|
if let Some(last_quoted_line) = last_quoted_line {
|
||||||
(
|
(
|
||||||
&lines[last_quoted_line + 1..],
|
lines.get(last_quoted_line + 1..).unwrap_or(lines),
|
||||||
Some(
|
Some(
|
||||||
lines[first_quoted_line..last_quoted_line + 1]
|
lines
|
||||||
.iter()
|
.iter()
|
||||||
|
.take(last_quoted_line + 1)
|
||||||
|
.skip(first_quoted_line)
|
||||||
.map(|s| {
|
.map(|s| {
|
||||||
s.strip_prefix('>')
|
s.strip_prefix('>')
|
||||||
.map_or(*s, |u| u.strip_prefix(' ').unwrap_or(u))
|
.map_or(*s, |u| u.strip_prefix(' ').unwrap_or(u))
|
||||||
|
|||||||
Reference in New Issue
Block a user