diff options
author | bors-servo <metajack+bors@gmail.com> | 2015-08-12 07:29:47 -0600 |
---|---|---|
committer | bors-servo <metajack+bors@gmail.com> | 2015-08-12 07:29:47 -0600 |
commit | 54300a9c73f7c8289604ab9a957419577e10c1ac (patch) | |
tree | 2e26d6410f0375f37421302d08f941140327d93d | |
parent | 2f0a9e7fce9b8d3ee5ddf0cc5431547462378ff0 (diff) | |
parent | 1ef10550b1c5d2730194cbc06d7f790b7472dbf8 (diff) | |
download | servo-54300a9c73f7c8289604ab9a957419577e10c1ac.tar.gz servo-54300a9c73f7c8289604ab9a957419577e10c1ac.zip |
Auto merge of #7170 - Ms2ger:unwrap-constellation, r=jdm
Avoid unwrap calls in handle_navigate_msg.
<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7170)
<!-- Reviewable:end -->
-rw-r--r-- | components/compositing/constellation.rs | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/components/compositing/constellation.rs b/components/compositing/constellation.rs index 50e755eb086..ab5a69b429e 100644 --- a/components/compositing/constellation.rs +++ b/components/compositing/constellation.rs @@ -798,20 +798,28 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> { let next = match direction { NavigationDirection::Forward => { - if frame.next.is_empty() { - debug!("no next page to navigate to"); - return; + match frame.next.pop() { + None => { + debug!("no next page to navigate to"); + return; + }, + Some(next) => { + frame.prev.push(frame.current); + next + }, } - frame.prev.push(frame.current); - frame.next.pop().unwrap() } NavigationDirection::Back => { - if frame.prev.is_empty() { - debug!("no previous page to navigate to"); - return; + match frame.prev.pop() { + None => { + debug!("no previous page to navigate to"); + return; + }, + Some(prev) => { + frame.next.push(frame.current); + prev + }, } - frame.next.push(frame.current); - frame.prev.pop().unwrap() } }; let prev = frame.current; |