Auto merge of #18968 - mbrubeck:try, r=emilio

Use try syntax for Option where appropriate

- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes do not require tests because they are refactoring only

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18968)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-10-21 03:31:21 -05:00 committed by GitHub
commit 2b03a9974c
19 changed files with 65 additions and 180 deletions

View file

@ -317,16 +317,10 @@ fn run_server(sender: Sender<DevtoolsControlMsg>,
actor_pipelines: &HashMap<PipelineId, String>) -> Option<String> {
let actors = actors.lock().unwrap();
if let Some(worker_id) = worker_id {
let actor_name = match (*actor_workers).get(&(id, worker_id)) {
Some(name) => name,
None => return None,
};
let actor_name = (*actor_workers).get(&(id, worker_id))?;
Some(actors.find::<WorkerActor>(actor_name).console.clone())
} else {
let actor_name = match (*actor_pipelines).get(&id) {
Some(name) => name,
None => return None,
};
let actor_name = (*actor_pipelines).get(&id)?;
Some(actors.find::<TabActor>(actor_name).console.clone())
}
}