Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upReplace side-effecting unwrap_or_else by if let in constellation. #10345
Conversation
|
-S-awaiting-review +S-needs-code-changes Reviewed 1 of 1 files at r1. components/compositing/constellation.rs, line 717 [r1] (raw file): In that case, I would do: if let Some(pipeline) = self.pipelines.get(&pipeline_id) {
if let Err(e) = pipeline.script_chan.send(msg) {
self.handle_send_error(pipeline_id, e);
}
} else {
debug!(...);
return true;
}components/compositing/constellation.rs, line 729 [r1] (raw file): components/compositing/constellation.rs, line 908 [r1] (raw file): if let Some(pipeline) = self.pipelines.get_mut(&pipeline_id) {
pipeline.size = Some(*size);
if let Err(e) = pipeline.script_chan.send(msg) {
self.handle_send_error(pipeline_id, e);
}
}components/compositing/constellation.rs, line 930 [r1] (raw file):
components/compositing/constellation.rs, line 1030 [r1] (raw file): let pipeline = match self.pipelines.get(&pipeline_id) {
Some(pipeline) => pipeline,
None => {
debug!(...);
return;
}
};
let result = match tick_type {
AnimationTickType::Script => {
pipeline.script_chan.0.send(ConstellationControlMsg::TickAllAnimations(pipeline_id))
},
AnimationTickType::Layout => {
pipeline.layout_chan.0.send(LayoutControlMsg::TickAnimations)
}
};
if let Err(e) = result {
self.handle_send_error(pipeline_id, e);
}I really think we should have a specific function on pipelines, which would take a channel and a message and would call components/compositing/constellation.rs, line 1042 [r1] (raw file): let (parent_info, window_size) =
self.pipelines.get(&source_id)
.map(|source| (source.parent_info, source.size))
.unwrap_or((None, None));components/compositing/constellation.rs, line 1058 [r1] (raw file): components/compositing/constellation.rs, line 1083 [r1] (raw file): components/compositing/constellation.rs, line 1235 [r1] (raw file): components/compositing/constellation.rs, line 1253 [r1] (raw file): components/compositing/constellation.rs, line 1262 [r1] (raw file): components/compositing/constellation.rs, line 1338 [r1] (raw file): components/compositing/constellation.rs, line 1411 [r1] (raw file): components/compositing/constellation.rs, line 1431 [r1] (raw file): Comments from Reviewable |
|
@nox: I reverted some of your suggested changes, since I couldn't get them to pass borrowchk. Serves me right for checking in changes without compiling them! |
|
Review status: 0 of 1 files reviewed at latest revision, 14 unresolved discussions. components/compositing/constellation.rs, line 717 [r1] (raw file): components/compositing/constellation.rs, line 729 [r1] (raw file): components/compositing/constellation.rs, line 908 [r1] (raw file): Comments from Reviewable |
|
Review status: 0 of 1 files reviewed at latest revision, 14 unresolved discussions. components/compositing/constellation.rs, line 717 [r1] (raw file): components/compositing/constellation.rs, line 729 [r1] (raw file): components/compositing/constellation.rs, line 908 [r1] (raw file): Comments from Reviewable |
|
Rebased and squashed. |
|
|
|
Rebased. |
|
|
|
Rebased. @nox: this is bitrotting. |
|
|
|
Another rebase. Serious bitrotting here :( |
|
Sorry about this @asajeffrey. Looks good to me with your last remarks and changes. @bors-servo r+ |
|
|
Replace side-effecting unwrap_or_else by if let in constellation. This addresses @nox's comments in #10295. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10345) <!-- Reviewable:end -->
|
|
|
Thanks! |
asajeffrey commentedApr 1, 2016
This addresses @nox's comments in #10295.
This change is