diff options
| author | bors <bors@rust-lang.org> | 2015-03-20 23:16:47 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-03-20 23:16:47 +0000 |
| commit | e2fa53e593a854a609ae9efe5a1bbe15265f0a6f (patch) | |
| tree | 31d6cf6dcb795deb1b8bda95d58cfbf02002000b /src/libterm | |
| parent | 68d69415637186755482d2584e6ba82b67bc1d89 (diff) | |
| parent | b4a1e59146c70a12d8c4c1f85c08a2ecf9fb3d2e (diff) | |
| download | rust-e2fa53e593a854a609ae9efe5a1bbe15265f0a6f.tar.gz rust-e2fa53e593a854a609ae9efe5a1bbe15265f0a6f.zip | |
Auto merge of #23512 - oli-obk:result_ok_unwrap, r=alexcrichton
because then the call to `unwrap()` will not print the error object.
Diffstat (limited to 'src/libterm')
| -rw-r--r-- | src/libterm/terminfo/mod.rs | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/src/libterm/terminfo/mod.rs b/src/libterm/terminfo/mod.rs index 3c269cc485d..309320b52ff 100644 --- a/src/libterm/terminfo/mod.rs +++ b/src/libterm/terminfo/mod.rs @@ -181,21 +181,24 @@ impl<T: Write+Send+'static> TerminfoTerminal<T> { } }; - let entry = open(&term[..]); - if entry.is_err() { - if env::var("MSYSCON").ok().map_or(false, |s| { - "mintty.exe" == s - }) { - // msys terminal - return Some(box TerminfoTerminal {out: out, - ti: msys_terminfo(), - num_colors: 8} as Box<Terminal<T>+Send>); - } - debug!("error finding terminfo entry: {:?}", entry.err().unwrap()); - return None; - } + let mut file = match open(&term[..]) { + Ok(f) => f, + Err(err) => return match env::var("MSYSCON") { + Ok(ref val) if &val[..] == "mintty.exe" => { + // msys terminal + Some(box TerminfoTerminal{ + out: out, + ti: msys_terminfo(), + num_colors: 8, + } as Box<Terminal<T>+Send>) + }, + _ => { + debug!("error finding terminfo entry: {:?}", err); + None + }, + }, + }; - let mut file = entry.unwrap(); let ti = parse(&mut file, false); if ti.is_err() { debug!("error parsing terminfo entry: {:?}", ti.err().unwrap()); |
