Avoid an unnecessary unwrap() call in handle_take_screenshot.

This commit is contained in:
Ms2ger 2015-10-06 18:10:48 +02:00
parent 1f45a736e5
commit 2e16c3ca8a

View file

@ -615,12 +615,13 @@ impl Handler {
sleep_ms(interval) sleep_ms(interval)
} }
if img.is_none() { let mut img = match img {
return Err(WebDriverError::new(ErrorStatus::Timeout, Some(img) => img,
"Taking screenshot timed out")); None => return Err(WebDriverError::new(ErrorStatus::Timeout,
} "Taking screenshot timed out")),
};
let img_vec = match png::to_vec(&mut img.unwrap()) { let img_vec = match png::to_vec(&mut img) {
Ok(x) => x, Ok(x) => x,
Err(_) => return Err(WebDriverError::new(ErrorStatus::UnknownError, Err(_) => return Err(WebDriverError::new(ErrorStatus::UnknownError,
"Taking screenshot failed")) "Taking screenshot failed"))