Allow drafts without text if there is a quote

This commit is contained in:
Hocuri
2020-10-09 19:58:56 +02:00
committed by link2xt
parent 990ab739cc
commit cf5342c367
2 changed files with 20 additions and 8 deletions

View File

@@ -709,6 +709,21 @@ pub(crate) fn improve_single_line_input(input: impl AsRef<str>) -> String {
.to_string()
}
pub(crate) trait IsNoneOrEmpty<T> {
fn is_none_or_empty(&self) -> bool;
}
impl<T> IsNoneOrEmpty<T> for Option<T>
where
T: AsRef<str>,
{
fn is_none_or_empty(&self) -> bool {
match self {
Some(s) if !s.as_ref().is_empty() => false,
_ => true,
}
}
}
#[cfg(test)]
mod tests {
#![allow(clippy::indexing_slicing)]