summaryrefslogtreecommitdiff
path: root/src/cmd/list.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/list.rs')
-rw-r--r--src/cmd/list.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/cmd/list.rs b/src/cmd/list.rs
index 65f128f..f34c333 100644
--- a/src/cmd/list.rs
+++ b/src/cmd/list.rs
@@ -9,8 +9,8 @@ use crate::error::Result;
use crate::pb3::jwebmail::{ListMailHeader, ListReq, ListResp, MailHeader};
use crate::rfc822::me_to_lmh;
-fn from_or_sender<'a>(mh: &'a MailHeader) -> &'a str {
- if mh.written_from.len() == 0 {
+fn from_or_sender(mh: &MailHeader) -> &str {
+ if mh.written_from.is_empty() {
warn!("mail without from");
panic!()
}
@@ -80,7 +80,7 @@ fn sort_by_and_take(
.drain(..)
.filter_map(|me| me_to_lmh(me).map_err(|e| warn!("{}", e)).ok())
.collect();
- if sortby.bytes().nth(0) == Some(b'!') {
+ if sortby.as_bytes().first().copied() == Some(b'!') {
x.sort_by(|a, b| a.header.subject.cmp(&b.header.subject))
} else {
x.sort_by(|b, a| a.header.subject.cmp(&b.header.subject))
@@ -92,7 +92,7 @@ fn sort_by_and_take(
.drain(..)
.filter_map(|me| me_to_lmh(me).map_err(|e| warn!("{}", e)).ok())
.collect();
- if sortby.bytes().nth(0) != Some(b'!') {
+ if sortby.as_bytes().first().copied() != Some(b'!') {
x.sort_by(|a, b| from_or_sender(&a.header).cmp(from_or_sender(&b.header)))
} else {
x.sort_by(|b, a| from_or_sender(&a.header).cmp(from_or_sender(&b.header)))