diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2016-03-28 04:12:31 +0530 |
---|---|---|
committer | bors-servo <lbergstrom+bors@mozilla.com> | 2016-03-28 04:12:31 +0530 |
commit | b97ffffb48080a0b4769f8609a27a68145042945 (patch) | |
tree | 6a8c50176786ef2fd387292d00aa49b588e187a2 | |
parent | 0826a5b45455cdbecf484136b1bab39bcc0b15ff (diff) | |
parent | 7c45a4fea031ac97400c6b8416a7b4b897bd0f52 (diff) | |
download | servo-b97ffffb48080a0b4769f8609a27a68145042945.tar.gz servo-b97ffffb48080a0b4769f8609a27a68145042945.zip |
Auto merge of #10222 - faineance:master, r=KiChjang
Use self.0 instead of destructuring single item tuple structs.
Closes #9698.
<!-- 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/10222)
<!-- Reviewable:end -->
-rw-r--r-- | components/compositing/surface_map.rs | 3 | ||||
-rw-r--r-- | components/gfx_traits/lib.rs | 6 | ||||
-rw-r--r-- | components/layout/block.rs | 3 | ||||
-rw-r--r-- | components/layout/opaque_node.rs | 3 | ||||
-rw-r--r-- | components/net/fetch/cors_cache.rs | 9 | ||||
-rw-r--r-- | components/profile_traits/mem.rs | 6 | ||||
-rw-r--r-- | components/profile_traits/time.rs | 3 | ||||
-rw-r--r-- | components/script/cors.rs | 9 | ||||
-rw-r--r-- | components/script/dom/bindings/str.rs | 3 | ||||
-rw-r--r-- | components/script/script_thread.rs | 12 | ||||
-rw-r--r-- | components/script/task_source/dom_manipulation.rs | 6 | ||||
-rw-r--r-- | components/script/task_source/file_reading.rs | 6 | ||||
-rw-r--r-- | components/script/task_source/history_traversal.rs | 6 | ||||
-rw-r--r-- | components/script/task_source/networking.rs | 6 | ||||
-rw-r--r-- | components/script/task_source/user_interaction.rs | 6 | ||||
-rw-r--r-- | components/style/dom.rs | 3 | ||||
-rw-r--r-- | components/style/values.rs | 18 |
17 files changed, 37 insertions, 71 deletions
diff --git a/components/compositing/surface_map.rs b/components/compositing/surface_map.rs index d5f0cfba2f7..97b10a0677e 100644 --- a/components/compositing/surface_map.rs +++ b/components/compositing/surface_map.rs @@ -29,8 +29,7 @@ struct SurfaceKey([i32; 2]); impl Hash for SurfaceKey { fn hash<H: Hasher>(&self, state: &mut H) { - let SurfaceKey(ref bytes) = *self; - bytes.hash(state); + self.0.hash(state); } } diff --git a/components/gfx_traits/lib.rs b/components/gfx_traits/lib.rs index b7af8286af0..5833e847a91 100644 --- a/components/gfx_traits/lib.rs +++ b/components/gfx_traits/lib.rs @@ -140,8 +140,7 @@ pub struct Epoch(pub u32); impl Epoch { pub fn next(&mut self) { - let Epoch(ref mut u) = *self; - *u += 1; + self.0 += 1; } } @@ -150,7 +149,6 @@ pub struct FrameTreeId(pub u32); impl FrameTreeId { pub fn next(&mut self) { - let FrameTreeId(ref mut u) = *self; - *u += 1; + self.0 += 1; } } diff --git a/components/layout/block.rs b/components/layout/block.rs index b987313b21f..a502611df3b 100644 --- a/components/layout/block.rs +++ b/components/layout/block.rs @@ -471,8 +471,7 @@ impl<'a> PreorderFlowTraversal for AbsoluteAssignBSizesTraversal<'a> { return } - let AbsoluteAssignBSizesTraversal(ref layout_context) = *self; - block.calculate_absolute_block_size_and_margins(*layout_context); + block.calculate_absolute_block_size_and_margins(&self.0); } } diff --git a/components/layout/opaque_node.rs b/components/layout/opaque_node.rs index 2b307288afa..8bde9e6cc09 100644 --- a/components/layout/opaque_node.rs +++ b/components/layout/opaque_node.rs @@ -38,7 +38,6 @@ impl OpaqueNodeMethods for OpaqueNode { } fn to_untrusted_node_address(&self) -> UntrustedNodeAddress { - let OpaqueNode(addr) = *self; - UntrustedNodeAddress(addr as *const c_void) + UntrustedNodeAddress(self.0 as *const c_void) } } diff --git a/components/net/fetch/cors_cache.rs b/components/net/fetch/cors_cache.rs index 63c62f37c23..dc640ce4c37 100644 --- a/components/net/fetch/cors_cache.rs +++ b/components/net/fetch/cors_cache.rs @@ -124,16 +124,14 @@ impl BasicCORSCache { fn find_entry_by_header<'a>(&'a mut self, request: &CacheRequestDetails, header_name: &str) -> Option<&'a mut CORSCacheEntry> { self.cleanup(); - let BasicCORSCache(ref mut buf) = *self; - buf.iter_mut().find(|e| match_headers(e, request) && e.header_or_method.match_header(header_name)) + self.0.iter_mut().find(|e| match_headers(e, request) && e.header_or_method.match_header(header_name)) } fn find_entry_by_method<'a>(&'a mut self, request: &CacheRequestDetails, method: Method) -> Option<&'a mut CORSCacheEntry> { // we can take the method from CORSRequest itself self.cleanup(); - let BasicCORSCache(ref mut buf) = *self; - buf.iter_mut().find(|e| match_headers(e, request) && e.header_or_method.match_method(&method)) + self.0.iter_mut().find(|e| match_headers(e, request) && e.header_or_method.match_method(&method)) } } @@ -190,8 +188,7 @@ impl CORSCache for BasicCORSCache { fn insert(&mut self, entry: CORSCacheEntry) { self.cleanup(); - let BasicCORSCache(ref mut buf) = *self; - buf.push(entry); + self.0.push(entry); } } diff --git a/components/profile_traits/mem.rs b/components/profile_traits/mem.rs index 7b377a00385..794874581b9 100644 --- a/components/profile_traits/mem.rs +++ b/components/profile_traits/mem.rs @@ -33,8 +33,7 @@ impl ProfilerChan { /// /// Panics if the send fails. pub fn send(&self, msg: ProfilerMsg) { - let ProfilerChan(ref c) = *self; - c.send(msg).unwrap(); + self.0.send(msg).unwrap(); } /// Runs `f()` with memory profiling. @@ -118,8 +117,7 @@ impl ReportsChan { /// /// Panics if the send fails. pub fn send(&self, report: Vec<Report>) { - let ReportsChan(ref c) = *self; - c.send(report).unwrap(); + self.0.send(report).unwrap(); } } diff --git a/components/profile_traits/time.rs b/components/profile_traits/time.rs index 8a673d4db0d..203d2953065 100644 --- a/components/profile_traits/time.rs +++ b/components/profile_traits/time.rs @@ -20,8 +20,7 @@ pub struct ProfilerChan(pub IpcSender<ProfilerMsg>); impl ProfilerChan { pub fn send(&self, msg: ProfilerMsg) { - let ProfilerChan(ref c) = *self; - c.send(msg).unwrap(); + self.0.send(msg).unwrap(); } } diff --git a/components/script/cors.rs b/components/script/cors.rs index b5ad670a38c..8be1ec9d6d2 100644 --- a/components/script/cors.rs +++ b/components/script/cors.rs @@ -394,9 +394,8 @@ impl CORSCache { header_name: &str) -> Option<&'a mut CORSCacheEntry> { self.cleanup(); - let CORSCache(ref mut buf) = *self; // Credentials are not yet implemented here - buf.iter_mut().find(|e| { + self.0.iter_mut().find(|e| { e.origin.scheme == request.origin.scheme && e.origin.host() == request.origin.host() && e.origin.port() == request.origin.port() && e.url == request.destination && e.header_or_method.match_header(header_name) @@ -421,9 +420,8 @@ impl CORSCache { -> Option<&'a mut CORSCacheEntry> { // we can take the method from CORSRequest itself self.cleanup(); - let CORSCache(ref mut buf) = *self; // Credentials are not yet implemented here - buf.iter_mut().find(|e| { + self.0.iter_mut().find(|e| { e.origin.scheme == request.origin.scheme && e.origin.host() == request.origin.host() && e.origin.port() == request.origin.port() && e.url == request.destination && e.header_or_method.match_method(method) @@ -445,8 +443,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..5876f7d16c9 100644 --- a/components/script/script_thread.rs +++ b/components/script/script_thread.rs @@ -321,13 +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; - box SendableMainThreadScriptChan((*chan).clone()) + box SendableMainThreadScriptChan((&self.0).clone()) } } @@ -345,13 +343,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; - box MainThreadScriptChan((*chan).clone()) + box MainThreadScriptChan((&self.0).clone()) } } diff --git a/components/script/task_source/dom_manipulation.rs b/components/script/task_source/dom_manipulation.rs index d60ce7de93d..9676ade6ded 100644 --- a/components/script/task_source/dom_manipulation.rs +++ b/components/script/task_source/dom_manipulation.rs @@ -16,13 +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; - box DOMManipulationTaskSource((*chan).clone()) + box DOMManipulationTaskSource((&self.0).clone()) } } diff --git a/components/script/task_source/file_reading.rs b/components/script/task_source/file_reading.rs index e4afad34b4b..30e9530a76d 100644 --- a/components/script/task_source/file_reading.rs +++ b/components/script/task_source/file_reading.rs @@ -10,12 +10,10 @@ 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; - box FileReadingTaskSource((*chan).clone()) + box FileReadingTaskSource((&self.0).clone()) } } diff --git a/components/script/task_source/history_traversal.rs b/components/script/task_source/history_traversal.rs index 0916c121345..c2d276e6eec 100644 --- a/components/script/task_source/history_traversal.rs +++ b/components/script/task_source/history_traversal.rs @@ -10,12 +10,10 @@ 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; - box HistoryTraversalTaskSource((*chan).clone()) + box HistoryTraversalTaskSource((&self.0).clone()) } } diff --git a/components/script/task_source/networking.rs b/components/script/task_source/networking.rs index 8ebeecdb965..83160468395 100644 --- a/components/script/task_source/networking.rs +++ b/components/script/task_source/networking.rs @@ -10,12 +10,10 @@ 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; - box NetworkingTaskSource((*chan).clone()) + box NetworkingTaskSource((&self.0).clone()) } } diff --git a/components/script/task_source/user_interaction.rs b/components/script/task_source/user_interaction.rs index 7912eac720d..254b0d008d1 100644 --- a/components/script/task_source/user_interaction.rs +++ b/components/script/task_source/user_interaction.rs @@ -10,12 +10,10 @@ 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; - box UserInteractionTaskSource((*chan).clone()) + box UserInteractionTaskSource((&self.0).clone()) } } diff --git a/components/style/dom.rs b/components/style/dom.rs index 861cec599a2..7a332806c09 100644 --- a/components/style/dom.rs +++ b/components/style/dom.rs @@ -37,8 +37,7 @@ impl OpaqueNode { /// Returns the address of this node, for debugging purposes. #[inline] pub fn id(&self) -> usize { - let OpaqueNode(pointer) = *self; - pointer + self.0 } } diff --git a/components/style/values.rs b/components/style/values.rs index 69cd83309fc..80a9a86b797 100644 --- a/components/style/values.rs +++ b/components/style/values.rs @@ -1077,10 +1077,9 @@ pub mod specified { impl ToCss for BorderRadiusSize { fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { - let BorderRadiusSize(size) = *self; - try!(size.width.to_css(dest)); + try!(self.0.width.to_css(dest)); try!(dest.write_str(" ")); - size.height.to_css(dest) + self.0.height.to_css(dest) } } @@ -1133,8 +1132,7 @@ pub mod specified { impl ToCss for Angle { fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { - let Angle(value) = *self; - write!(dest, "{}rad", value) + write!(dest, "{}rad", self.0) } } @@ -1642,19 +1640,17 @@ pub mod computed { #[inline] fn to_computed_value<Cx: TContext>(&self, context: &Cx) -> BorderRadiusSize { - let specified::BorderRadiusSize(s) = *self; - let w = s.width.to_computed_value(context); - let h = s.height.to_computed_value(context); + let w = self.0.width.to_computed_value(context); + let h = self.0.height.to_computed_value(context); BorderRadiusSize(Size2D::new(w, h)) } } impl ::cssparser::ToCss for BorderRadiusSize { fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { - let BorderRadiusSize(s) = *self; - try!(s.width.to_css(dest)); + try!(self.0.width.to_css(dest)); try!(dest.write_str("/")); - s.height.to_css(dest) + self.0.height.to_css(dest) } } |