aboutsummaryrefslogtreecommitdiffstats
path: root/components/devtools/lib.rs
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2016-12-31 21:28:41 -0800
committerGitHub <noreply@github.com>2016-12-31 21:28:41 -0800
commitd967d89fc081ae0f48850f3e29e4a9848bd837c7 (patch)
treeeb8e687e87b6ab7ee95996439e4e38ee927bd8fd /components/devtools/lib.rs
parent2ebcad10f58151a1c531d80794a0211ba12cbeb0 (diff)
parentb78979d6920639b72d514f87cc43bd354f107937 (diff)
downloadservo-d967d89fc081ae0f48850f3e29e4a9848bd837c7.tar.gz
servo-d967d89fc081ae0f48850f3e29e4a9848bd837c7.zip
Auto merge of #14796 - jlevesy:jl-match-to-if-let, r=Wafflespeanut
replace match by if let statements if possible <!-- Please describe your changes on the following line: --> Hi there, This PR replaces `match` statements by `if let` when possible. Thanks for reviewing --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #14788 <!-- Either: --> - [ ] There are tests for these changes OR - [X] These changes do not require tests because this PR is a code cleanup patch. <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- 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/14796) <!-- Reviewable:end -->
Diffstat (limited to 'components/devtools/lib.rs')
-rw-r--r--components/devtools/lib.rs13
1 files changed, 5 insertions, 8 deletions
diff --git a/components/devtools/lib.rs b/components/devtools/lib.rs
index c98bb270333..b492f774e07 100644
--- a/components/devtools/lib.rs
+++ b/components/devtools/lib.rs
@@ -179,14 +179,11 @@ fn run_server(sender: Sender<DevtoolsControlMsg>,
'outer: loop {
match stream.read_json_packet() {
Ok(Some(json_packet)) => {
- match actors.lock().unwrap().handle_message(json_packet.as_object().unwrap(),
- &mut stream) {
- Ok(()) => {},
- Err(()) => {
- debug!("error: devtools actor stopped responding");
- let _ = stream.shutdown(Shutdown::Both);
- break 'outer
- }
+ if let Err(()) = actors.lock().unwrap().handle_message(json_packet.as_object().unwrap(),
+ &mut stream) {
+ debug!("error: devtools actor stopped responding");
+ let _ = stream.shutdown(Shutdown::Both);
+ break 'outer
}
}
Ok(None) => {