aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout/flow_ref.rs
diff options
context:
space:
mode:
authorSimon Sapin <simon.sapin@exyr.org>2018-11-01 21:43:04 +0100
committerSimon Sapin <simon.sapin@exyr.org>2018-11-08 09:28:00 +0100
commit2012be4a8bd97f2fd69f986c8fffb1af1eec21dc (patch)
treec9f1ef91146253f72987cb1436866523880965e0 /components/layout/flow_ref.rs
parentb1fd6237d1304f3d57abdafd3e6e738c1ece9f83 (diff)
downloadservo-2012be4a8bd97f2fd69f986c8fffb1af1eec21dc.tar.gz
servo-2012be4a8bd97f2fd69f986c8fffb1af1eec21dc.zip
`cargo fix --edition-idioms`
Diffstat (limited to 'components/layout/flow_ref.rs')
-rw-r--r--components/layout/flow_ref.rs20
1 files changed, 10 insertions, 10 deletions
diff --git a/components/layout/flow_ref.rs b/components/layout/flow_ref.rs
index 31748f7039d..6b9027459ee 100644
--- a/components/layout/flow_ref.rs
+++ b/components/layout/flow_ref.rs
@@ -13,11 +13,11 @@ use std::ops::Deref;
use std::sync::{Arc, Weak};
#[derive(Clone, Debug)]
-pub struct FlowRef(Arc<Flow>);
+pub struct FlowRef(Arc<dyn Flow>);
impl Deref for FlowRef {
- type Target = Flow;
- fn deref(&self) -> &Flow {
+ type Target = dyn Flow;
+ fn deref(&self) -> &dyn Flow {
self.0.deref()
}
}
@@ -25,19 +25,19 @@ impl Deref for FlowRef {
impl FlowRef {
/// `FlowRef`s can only be made available to the traversal code.
/// See https://github.com/servo/servo/issues/14014 for more details.
- pub fn new(mut r: Arc<Flow>) -> Self {
+ pub fn new(mut r: Arc<dyn Flow>) -> Self {
// This assertion checks that this `FlowRef` does not alias normal `Arc`s.
// If that happens, we're in trouble.
assert!(Arc::get_mut(&mut r).is_some());
FlowRef(r)
}
- pub fn get_mut(this: &mut FlowRef) -> Option<&mut Flow> {
+ pub fn get_mut(this: &mut FlowRef) -> Option<&mut dyn Flow> {
Arc::get_mut(&mut this.0)
}
pub fn downgrade(this: &FlowRef) -> WeakFlowRef {
WeakFlowRef(Arc::downgrade(&this.0))
}
- pub fn into_arc(mut this: FlowRef) -> Arc<Flow> {
+ pub fn into_arc(mut this: FlowRef) -> Arc<dyn Flow> {
// This assertion checks that this `FlowRef` does not alias normal `Arc`s.
// If that happens, we're in trouble.
assert!(FlowRef::get_mut(&mut this).is_some());
@@ -48,14 +48,14 @@ impl FlowRef {
/// See https://github.com/servo/servo/issues/6503
/// Use Arc::get_mut instead when possible (e.g. on an Arc that was just created).
#[allow(unsafe_code)]
- pub fn deref_mut(this: &mut FlowRef) -> &mut Flow {
- let ptr: *const Flow = &*this.0;
- unsafe { &mut *(ptr as *mut Flow) }
+ pub fn deref_mut(this: &mut FlowRef) -> &mut dyn Flow {
+ let ptr: *const dyn Flow = &*this.0;
+ unsafe { &mut *(ptr as *mut dyn Flow) }
}
}
#[derive(Clone, Debug)]
-pub struct WeakFlowRef(Weak<Flow>);
+pub struct WeakFlowRef(Weak<dyn Flow>);
impl WeakFlowRef {
pub fn upgrade(&self) -> Option<FlowRef> {