about summary refs log tree commit diff
path: root/src/libterm/terminfo
diff options
context:
space:
mode:
authorJosh Stone <jistone@redhat.com>2020-04-24 20:03:45 -0700
committerJosh Stone <jistone@redhat.com>2020-04-24 20:03:45 -0700
commit4282776b1c394ed470d33f95c62538a2d37b16d3 (patch)
tree56488a35e541b93dee40508b891a4bf0a916785d /src/libterm/terminfo
parent3360cc3a0ea33c84d0b0b1163107b1c1acbf2a69 (diff)
Replace filter_map().next() calls with find_map()
These are semantically the same, but `find_map()` is more concise.
Diffstat (limited to 'src/libterm/terminfo')
-rw-r--r--src/libterm/terminfo/mod.rs15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/libterm/terminfo/mod.rs b/src/libterm/terminfo/mod.rs
index 918875e792a..fec59aaa0c2 100644
--- a/src/libterm/terminfo/mod.rs
+++ b/src/libterm/terminfo/mod.rs
@@ -173,14 +173,13 @@ impl<T: Write + Send> Terminal for TerminfoTerminal<T> {
     fn reset(&mut self) -> io::Result<bool> {
         // are there any terminals that have color/attrs and not sgr0?
         // Try falling back to sgr, then op
-        let cmd =
-            match ["sgr0", "sgr", "op"].iter().filter_map(|cap| self.ti.strings.get(*cap)).next() {
-                Some(op) => match expand(&op, &[], &mut Variables::new()) {
-                    Ok(cmd) => cmd,
-                    Err(e) => return Err(io::Error::new(io::ErrorKind::InvalidData, e)),
-                },
-                None => return Ok(false),
-            };
+        let cmd = match ["sgr0", "sgr", "op"].iter().find_map(|cap| self.ti.strings.get(*cap)) {
+            Some(op) => match expand(&op, &[], &mut Variables::new()) {
+                Ok(cmd) => cmd,
+                Err(e) => return Err(io::Error::new(io::ErrorKind::InvalidData, e)),
+            },
+            None => return Ok(false),
+        };
         self.out.write_all(&cmd).and(Ok(true))
     }