aboutsummaryrefslogtreecommitdiffstats
path: root/components/script
diff options
context:
space:
mode:
authorfaineance <faineance@users.noreply.github.com>2016-03-27 11:50:08 +0100
committerfaineance <faineance@users.noreply.github.com>2016-03-27 11:50:08 +0100
commit418842faf9135da4b70b12fd8b88bc6b8d504cfc (patch)
tree64690189fcf218696759273c2c29cc2799db8e25 /components/script
parent68a8085a2f11d052948145980a0bf8a46471e3a7 (diff)
downloadservo-418842faf9135da4b70b12fd8b88bc6b8d504cfc.tar.gz
servo-418842faf9135da4b70b12fd8b88bc6b8d504cfc.zip
use self.0 instead of destructing single item tuple structs
Diffstat (limited to 'components/script')
-rw-r--r--components/script/cors.rs7
-rw-r--r--components/script/dom/bindings/str.rs3
-rw-r--r--components/script/script_thread.rs10
-rw-r--r--components/script/task_source/dom_manipulation.rs5
-rw-r--r--components/script/task_source/file_reading.rs5
-rw-r--r--components/script/task_source/history_traversal.rs5
-rw-r--r--components/script/task_source/networking.rs5
-rw-r--r--components/script/task_source/user_interaction.rs5
8 files changed, 18 insertions, 27 deletions
diff --git a/components/script/cors.rs b/components/script/cors.rs
index b5ad670a38c..11312aba407 100644
--- a/components/script/cors.rs
+++ b/components/script/cors.rs
@@ -394,7 +394,7 @@ impl CORSCache {
header_name: &str)
-> Option<&'a mut CORSCacheEntry> {
self.cleanup();
- let CORSCache(ref mut buf) = *self;
+ let ref mut buf = self.0;
// Credentials are not yet implemented here
buf.iter_mut().find(|e| {
e.origin.scheme == request.origin.scheme && e.origin.host() == request.origin.host() &&
@@ -421,7 +421,7 @@ impl CORSCache {
-> Option<&'a mut CORSCacheEntry> {
// we can take the method from CORSRequest itself
self.cleanup();
- let CORSCache(ref mut buf) = *self;
+ let ref mut buf = self.0;
// Credentials are not yet implemented here
buf.iter_mut().find(|e| {
e.origin.scheme == request.origin.scheme && e.origin.host() == request.origin.host() &&
@@ -445,8 +445,7 @@ impl CORSCache {
fn insert(&mut self, entry: CORSCacheEntry) {
self.cleanup();
- let CORSCache(ref mut buf) = *self;
- buf.push(entry);
+ self.0.push(entry);
}
}
diff --git a/components/script/dom/bindings/str.rs b/components/script/dom/bindings/str.rs
index 6276c2c19bd..f1de6297ceb 100644
--- a/components/script/dom/bindings/str.rs
+++ b/components/script/dom/bindings/str.rs
@@ -58,8 +58,7 @@ impl Into<Vec<u8>> for ByteString {
impl Hash for ByteString {
fn hash<H: Hasher>(&self, state: &mut H) {
- let ByteString(ref vec) = *self;
- vec.hash(state);
+ self.0.hash(state);
}
}
diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs
index 9cfc2627786..de3d6b5cae2 100644
--- a/components/script/script_thread.rs
+++ b/components/script/script_thread.rs
@@ -321,12 +321,11 @@ pub struct SendableMainThreadScriptChan(pub Sender<CommonScriptMsg>);
impl ScriptChan for SendableMainThreadScriptChan {
fn send(&self, msg: CommonScriptMsg) -> Result<(), ()> {
- let SendableMainThreadScriptChan(ref chan) = *self;
- chan.send(msg).map_err(|_| ())
+ self.0.send(msg).map_err(|_| ())
}
fn clone(&self) -> Box<ScriptChan + Send> {
- let SendableMainThreadScriptChan(ref chan) = *self;
+ let ref chan = self.0;
box SendableMainThreadScriptChan((*chan).clone())
}
}
@@ -345,12 +344,11 @@ pub struct MainThreadScriptChan(pub Sender<MainThreadScriptMsg>);
impl ScriptChan for MainThreadScriptChan {
fn send(&self, msg: CommonScriptMsg) -> Result<(), ()> {
- let MainThreadScriptChan(ref chan) = *self;
- chan.send(MainThreadScriptMsg::Common(msg)).map_err(|_| ())
+ self.0.send(MainThreadScriptMsg::Common(msg)).map_err(|_| ())
}
fn clone(&self) -> Box<ScriptChan + Send> {
- let MainThreadScriptChan(ref chan) = *self;
+ let ref chan = self.0;
box MainThreadScriptChan((*chan).clone())
}
}
diff --git a/components/script/task_source/dom_manipulation.rs b/components/script/task_source/dom_manipulation.rs
index d60ce7de93d..84ec1ca5e78 100644
--- a/components/script/task_source/dom_manipulation.rs
+++ b/components/script/task_source/dom_manipulation.rs
@@ -16,12 +16,11 @@ pub struct DOMManipulationTaskSource(pub Sender<MainThreadScriptMsg>);
impl TaskSource<DOMManipulationTask> for DOMManipulationTaskSource {
fn queue(&self, msg: DOMManipulationTask) -> Result<(), ()> {
- let DOMManipulationTaskSource(ref chan) = *self;
- chan.send(MainThreadScriptMsg::DOMManipulation(msg)).map_err(|_| ())
+ self.0.send(MainThreadScriptMsg::DOMManipulation(msg)).map_err(|_| ())
}
fn clone(&self) -> Box<TaskSource<DOMManipulationTask> + Send> {
- let DOMManipulationTaskSource(ref chan) = *self;
+ let ref chan = self.0;
box DOMManipulationTaskSource((*chan).clone())
}
}
diff --git a/components/script/task_source/file_reading.rs b/components/script/task_source/file_reading.rs
index e4afad34b4b..a9813167e34 100644
--- a/components/script/task_source/file_reading.rs
+++ b/components/script/task_source/file_reading.rs
@@ -10,12 +10,11 @@ pub struct FileReadingTaskSource(pub Sender<MainThreadScriptMsg>);
impl ScriptChan for FileReadingTaskSource {
fn send(&self, msg: CommonScriptMsg) -> Result<(), ()> {
- let FileReadingTaskSource(ref chan) = *self;
- chan.send(MainThreadScriptMsg::Common(msg)).map_err(|_| ())
+ self.0.send(MainThreadScriptMsg::Common(msg)).map_err(|_| ())
}
fn clone(&self) -> Box<ScriptChan + Send> {
- let FileReadingTaskSource(ref chan) = *self;
+ let ref chan = self.0;
box FileReadingTaskSource((*chan).clone())
}
}
diff --git a/components/script/task_source/history_traversal.rs b/components/script/task_source/history_traversal.rs
index 0916c121345..d4fb64864a3 100644
--- a/components/script/task_source/history_traversal.rs
+++ b/components/script/task_source/history_traversal.rs
@@ -10,12 +10,11 @@ pub struct HistoryTraversalTaskSource(pub Sender<MainThreadScriptMsg>);
impl ScriptChan for HistoryTraversalTaskSource {
fn send(&self, msg: CommonScriptMsg) -> Result<(), ()> {
- let HistoryTraversalTaskSource(ref chan) = *self;
- chan.send(MainThreadScriptMsg::Common(msg)).map_err(|_| ())
+ self.0.send(MainThreadScriptMsg::Common(msg)).map_err(|_| ())
}
fn clone(&self) -> Box<ScriptChan + Send> {
- let HistoryTraversalTaskSource(ref chan) = *self;
+ let ref chan = self.0;
box HistoryTraversalTaskSource((*chan).clone())
}
}
diff --git a/components/script/task_source/networking.rs b/components/script/task_source/networking.rs
index 8ebeecdb965..29a5997475e 100644
--- a/components/script/task_source/networking.rs
+++ b/components/script/task_source/networking.rs
@@ -10,12 +10,11 @@ pub struct NetworkingTaskSource(pub Sender<MainThreadScriptMsg>);
impl ScriptChan for NetworkingTaskSource {
fn send(&self, msg: CommonScriptMsg) -> Result<(), ()> {
- let NetworkingTaskSource(ref chan) = *self;
- chan.send(MainThreadScriptMsg::Common(msg)).map_err(|_| ())
+ self.0.send(MainThreadScriptMsg::Common(msg)).map_err(|_| ())
}
fn clone(&self) -> Box<ScriptChan + Send> {
- let NetworkingTaskSource(ref chan) = *self;
+ let ref chan = self.0;
box NetworkingTaskSource((*chan).clone())
}
}
diff --git a/components/script/task_source/user_interaction.rs b/components/script/task_source/user_interaction.rs
index 7912eac720d..a4a2549e63d 100644
--- a/components/script/task_source/user_interaction.rs
+++ b/components/script/task_source/user_interaction.rs
@@ -10,12 +10,11 @@ pub struct UserInteractionTaskSource(pub Sender<MainThreadScriptMsg>);
impl ScriptChan for UserInteractionTaskSource {
fn send(&self, msg: CommonScriptMsg) -> Result<(), ()> {
- let UserInteractionTaskSource(ref chan) = *self;
- chan.send(MainThreadScriptMsg::Common(msg)).map_err(|_| ())
+ self.0.send(MainThreadScriptMsg::Common(msg)).map_err(|_| ())
}
fn clone(&self) -> Box<ScriptChan + Send> {
- let UserInteractionTaskSource(ref chan) = *self;
+ let ref chan = self.0;
box UserInteractionTaskSource((*chan).clone())
}
}