aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/bluetooth/lib.rs30
-rw-r--r--components/constellation/constellation.rs9
-rw-r--r--components/script/dom/bindings/codegen/CodegenRust.py7
-rw-r--r--components/script/dom/event.rs21
-rw-r--r--components/script/dom/permissions.rs32
5 files changed, 50 insertions, 49 deletions
diff --git a/components/bluetooth/lib.rs b/components/bluetooth/lib.rs
index 1566a7345c9..8b5919d9708 100644
--- a/components/bluetooth/lib.rs
+++ b/components/bluetooth/lib.rs
@@ -664,14 +664,13 @@ impl BluetoothManager {
}
let _ = d.connect();
for _ in 0..MAXIMUM_TRANSACTION_TIME {
- match d.is_connected().unwrap_or(false) {
- true => return Ok(BluetoothResponse::GATTServerConnect(true)),
- false => {
- if is_mock_adapter(&adapter) {
- break;
- }
- thread::sleep(Duration::from_millis(CONNECTION_TIMEOUT_MS));
- },
+ if d.is_connected().unwrap_or(false) {
+ return Ok(BluetoothResponse::GATTServerConnect(true));
+ } else {
+ if is_mock_adapter(&adapter) {
+ break;
+ }
+ thread::sleep(Duration::from_millis(CONNECTION_TIMEOUT_MS));
}
// TODO: Step 5.1.4: Use the exchange MTU procedure.
}
@@ -693,9 +692,10 @@ impl BluetoothManager {
}
let _ = d.disconnect();
for _ in 0..MAXIMUM_TRANSACTION_TIME {
- match d.is_connected().unwrap_or(true) {
- true => thread::sleep(Duration::from_millis(CONNECTION_TIMEOUT_MS)),
- false => return Ok(()),
+ if d.is_connected().unwrap_or(true) {
+ thread::sleep(Duration::from_millis(CONNECTION_TIMEOUT_MS))
+ } else {
+ return Ok(());
}
}
return Err(BluetoothError::Network);
@@ -947,13 +947,13 @@ impl BluetoothManager {
let mut adapter = self.get_adapter()?;
match self.get_gatt_characteristic(&mut adapter, &id) {
Some(c) => {
- let result = match enable {
+ let result = if enable {
// (StartNotification) Step 8.
// TODO: Handle all the errors returned from the start_notify call.
- true => c.start_notify(),
-
+ c.start_notify()
+ } else {
// (StopNotification) Step 4.
- false => c.stop_notify(),
+ c.stop_notify()
};
match result {
// (StartNotification) Step 11.
diff --git a/components/constellation/constellation.rs b/components/constellation/constellation.rs
index 01d2df699f2..17918cb13a0 100644
--- a/components/constellation/constellation.rs
+++ b/components/constellation/constellation.rs
@@ -614,11 +614,12 @@ where
// If we are in multiprocess mode,
// a dedicated per-process hang monitor will be initialized later inside the content process.
// See run_content_process in servo/lib.rs
- let background_monitor_register = match opts::multiprocess() {
- true => None,
- false => Some(HangMonitorRegister::init(
+ let background_monitor_register = if opts::multiprocess() {
+ None
+ } else {
+ Some(HangMonitorRegister::init(
background_hang_monitor_sender.clone(),
- )),
+ ))
};
let (ipc_layout_sender, ipc_layout_receiver) =
diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py
index e7399d66307..1db23e50992 100644
--- a/components/script/dom/bindings/codegen/CodegenRust.py
+++ b/components/script/dom/bindings/codegen/CodegenRust.py
@@ -6399,13 +6399,10 @@ class CGDictionary(CGThing):
conversion = (
"{\n"
" rooted!(in(cx) let mut rval = UndefinedValue());\n"
- " match r#try!(get_dictionary_property(cx, object.handle(), \"%s\", rval.handle_mut())) {\n"
- " true => {\n"
+ " if r#try!(get_dictionary_property(cx, object.handle(), \"%s\", rval.handle_mut())) {\n"
"%s\n"
- " },\n"
- " false => {\n"
+ " } else {\n"
"%s\n"
- " },\n"
" }\n"
"}") % (member.identifier.name, indent(conversion), indent(default))
diff --git a/components/script/dom/event.rs b/components/script/dom/event.rs
index 61b9b14877e..fc18036bfc7 100644
--- a/components/script/dom/event.rs
+++ b/components/script/dom/event.rs
@@ -188,9 +188,10 @@ impl Event {
}
pub fn status(&self) -> EventStatus {
- match self.DefaultPrevented() {
- true => EventStatus::Canceled,
- false => EventStatus::NotCanceled,
+ if self.DefaultPrevented() {
+ EventStatus::Canceled
+ } else {
+ EventStatus::NotCanceled
}
}
@@ -320,9 +321,10 @@ pub enum EventBubbles {
impl From<bool> for EventBubbles {
fn from(boolean: bool) -> Self {
- match boolean {
- true => EventBubbles::Bubbles,
- false => EventBubbles::DoesNotBubble,
+ if boolean {
+ EventBubbles::Bubbles
+ } else {
+ EventBubbles::DoesNotBubble
}
}
}
@@ -344,9 +346,10 @@ pub enum EventCancelable {
impl From<bool> for EventCancelable {
fn from(boolean: bool) -> Self {
- match boolean {
- true => EventCancelable::Cancelable,
- false => EventCancelable::NotCancelable,
+ if boolean {
+ EventCancelable::Cancelable
+ } else {
+ EventCancelable::NotCancelable
}
}
}
diff --git a/components/script/dom/permissions.rs b/components/script/dom/permissions.rs
index 713e48425e4..aa8ea5e27db 100644
--- a/components/script/dom/permissions.rs
+++ b/components/script/dom/permissions.rs
@@ -304,26 +304,26 @@ pub fn get_descriptor_permission_state(
// The current solution is a workaround with a message box to warn about this,
// if the feature is not allowed in non-secure contexcts,
// and let the user decide to grant the permission or not.
- let state = match allowed_in_nonsecure_contexts(&permission_name) {
- true => PermissionState::Prompt,
- false => match PREFS
+ let state = if allowed_in_nonsecure_contexts(&permission_name) {
+ PermissionState::Prompt
+ } else {
+ if PREFS
.get("dom.permissions.testing.allowed_in_nonsecure_contexts")
.as_boolean()
.unwrap_or(false)
{
- true => PermissionState::Granted,
- false => {
- settings
- .as_window()
- .permission_state_invocation_results()
- .borrow_mut()
- .remove(&permission_name.to_string());
- prompt_user(&format!(
- "The {} {}",
- permission_name, NONSECURE_DIALOG_MESSAGE
- ))
- },
- },
+ PermissionState::Granted
+ } else {
+ settings
+ .as_window()
+ .permission_state_invocation_results()
+ .borrow_mut()
+ .remove(&permission_name.to_string());
+ prompt_user(&format!(
+ "The {} {}",
+ permission_name, NONSECURE_DIALOG_MESSAGE
+ ))
+ }
};
// Step 3.