summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Hurst <tom@hur.st>2018-09-04 22:40:14 +0100
committerKartikaya Gupta (kats) <staktrace@users.noreply.github.com>2018-09-05 04:05:28 -0400
commitbd195df0a8fc1615729bf01ea572f7e1f3e3b86c (patch)
tree24af61354c7c7661d2df7974310862dd583f38d7
parent8a49f59217f0e2591817f4852dec3e64c91ad3eb (diff)
downloadmailparse-bd195df0a8fc1615729bf01ea572f7e1f3e3b86c.tar.gz
mailparse-bd195df0a8fc1615729bf01ea572f7e1f3e3b86c.tar.xz
Use while let Some(..) over loop { match { .. }}
This looks like it should be a map().collect(), but do the smaller change first. clippy:while_let_on_iterator
-rw-r--r--src/lib.rs7
1 files changed, 1 insertions, 6 deletions
diff --git a/src/lib.rs b/src/lib.rs
index b17cb56..a10b03a 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -205,12 +205,7 @@ impl<'a> MailHeader<'a> {
));
let mut lines = chars.lines();
let mut add_space = false;
- loop {
- let line = match lines.next() {
- Some(v) => v.trim_left(),
- None => break,
- };
-
+ while let Some(line) = lines.next().map(str::trim_left) {
if add_space {
result.push(' ');
}