aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2015-11-23 08:18:20 +0530
committerbors-servo <lbergstrom+bors@mozilla.com>2015-11-23 08:18:20 +0530
commite3eee5a41b2bc6e3517cdcdc745d74c59a82e76e (patch)
tree93019ad5b05a7655c9baed34e0b71150fde83266
parentf6591a3d9e5e4b010d09fb2b2869234297367eec (diff)
parent99acd46c481b07b457530dd7d3c6975ea93bfc4c (diff)
downloadservo-e3eee5a41b2bc6e3517cdcdc745d74c59a82e76e.tar.gz
servo-e3eee5a41b2bc6e3517cdcdc745d74c59a82e76e.zip
Auto merge of #8597 - r0e:testing, r=Manishearth
Fix for #8593 'loop..match' should be 'while let' As per #8593. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8597) <!-- Reviewable:end -->
-rw-r--r--components/compositing/constellation.rs36
-rw-r--r--components/layout/block.rs31
-rw-r--r--components/style/values.rs11
3 files changed, 30 insertions, 48 deletions
diff --git a/components/compositing/constellation.rs b/components/compositing/constellation.rs
index 1055aabaa26..9e27d446432 100644
--- a/components/compositing/constellation.rs
+++ b/components/compositing/constellation.rs
@@ -681,17 +681,11 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
self.close_pipeline(pipeline_id, ExitPipelineMode::Force);
- loop {
- let pending_pipeline_id = self.pending_frames.iter().find(|pending| {
- pending.old_pipeline_id == Some(pipeline_id)
- }).map(|frame| frame.new_pipeline_id);
- match pending_pipeline_id {
- Some(pending_pipeline_id) => {
- debug!("removing pending frame change for failed pipeline");
- self.close_pipeline(pending_pipeline_id, ExitPipelineMode::Force);
- },
- None => break,
- }
+ while let Some(pending_pipeline_id) = self.pending_frames.iter().find(|pending| {
+ pending.old_pipeline_id == Some(pipeline_id)
+ }).map(|frame| frame.new_pipeline_id) {
+ debug!("removing pending frame change for failed pipeline");
+ self.close_pipeline(pending_pipeline_id, ExitPipelineMode::Force);
}
debug!("creating replacement pipeline for about:failure");
@@ -1241,20 +1235,14 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
// other hand, if no frames can be enabled after looping through all pending
// frames, we can safely exit the loop, knowing that we will need to wait on
// a dependent pipeline to be ready to paint.
- loop {
- let valid_frame_change = self.pending_frames.iter().rposition(|frame_change| {
- let waiting_on_dependency = frame_change.old_pipeline_id.map_or(false, |old_pipeline_id| {
- self.pipeline_to_frame_map.get(&old_pipeline_id).is_none()
- });
- frame_change.painter_ready && !waiting_on_dependency
+ while let Some(valid_frame_change) = self.pending_frames.iter().rposition(|frame_change| {
+ let waiting_on_dependency = frame_change.old_pipeline_id.map_or(false, |old_pipeline_id| {
+ self.pipeline_to_frame_map.get(&old_pipeline_id).is_none()
});
-
- if let Some(valid_frame_change) = valid_frame_change {
- let frame_change = self.pending_frames.swap_remove(valid_frame_change);
- self.add_or_replace_pipeline_in_frame_tree(frame_change);
- } else {
- break;
- }
+ frame_change.painter_ready && !waiting_on_dependency
+ }) {
+ let frame_change = self.pending_frames.swap_remove(valid_frame_change);
+ self.add_or_replace_pipeline_in_frame_tree(frame_change);
}
}
diff --git a/components/layout/block.rs b/components/layout/block.rs
index 13971d2a626..c84e2db9d75 100644
--- a/components/layout/block.rs
+++ b/components/layout/block.rs
@@ -1169,24 +1169,19 @@ impl BlockFlow {
// Can't use `for` because we assign to
// `candidate_block_size_iterator.candidate_value`.
- loop {
- match candidate_block_size_iterator.next() {
- Some(block_size_used_val) => {
- solution = Some(
- BSizeConstraintSolution::solve_vertical_constraints_abs_nonreplaced(
- block_size_used_val,
- margin_block_start,
- margin_block_end,
- block_start,
- block_end,
- content_block_size,
- available_block_size));
-
- candidate_block_size_iterator.candidate_value
- = solution.unwrap().block_size;
- }
- None => break,
- }
+ while let Some(block_size_used_val) = candidate_block_size_iterator.next() {
+ solution = Some(
+ BSizeConstraintSolution::solve_vertical_constraints_abs_nonreplaced(
+ block_size_used_val,
+ margin_block_start,
+ margin_block_end,
+ block_start,
+ block_end,
+ content_block_size,
+ available_block_size));
+
+ candidate_block_size_iterator.candidate_value
+ = solution.unwrap().block_size;
}
}
}
diff --git a/components/style/values.rs b/components/style/values.rs
index b6f630142b9..a475b86a334 100644
--- a/components/style/values.rs
+++ b/components/style/values.rs
@@ -524,18 +524,17 @@ pub mod specified {
let mut products = Vec::new();
products.push(try!(CalcLengthOrPercentage::parse_product(input, expected_unit)));
- loop {
- match input.next() {
- Ok(Token::Delim('+')) => {
+ while let Ok(token) = input.next() {
+ match token {
+ Token::Delim('+') => {
products.push(try!(CalcLengthOrPercentage::parse_product(input, expected_unit)));
}
- Ok(Token::Delim('-')) => {
+ Token::Delim('-') => {
let mut right = try!(CalcLengthOrPercentage::parse_product(input, expected_unit));
right.values.push(CalcValueNode::Number(-1.));
products.push(right);
}
- Ok(_) => return Err(()),
- _ => break
+ _ => return Err(())
}
}