Don’t mark flow_ref::deref_mut as unsafe.

See discussion in https://github.com/servo/servo/pull/7237
This commit is contained in:
Simon Sapin 2015-08-18 19:37:15 +02:00
parent 649250130b
commit 21d69314d4
10 changed files with 53 additions and 72 deletions

View file

@ -771,9 +771,8 @@ pub struct AbsoluteDescendantIter<'a> {
impl<'a> Iterator for AbsoluteDescendantIter<'a> {
type Item = &'a mut Flow;
#[allow(unsafe_code)]
fn next(&mut self) -> Option<&'a mut Flow> {
self.iter.next().map(|info| unsafe { flow_ref::deref_mut(&mut info.flow) })
self.iter.next().map(|info| flow_ref::deref_mut(&mut info.flow))
}
}
@ -1353,10 +1352,9 @@ impl MutableOwnedFlowUtils for FlowRef {
/// This is called during flow construction, so nothing else can be accessing the descendant
/// flows. This is enforced by the fact that we have a mutable `FlowRef`, which only flow
/// construction is allowed to possess.
#[allow(unsafe_code)]
fn set_absolute_descendants(&mut self, abs_descendants: AbsoluteDescendants) {
let this = self.clone();
let base = mut_base(unsafe { flow_ref::deref_mut(self) });
let base = mut_base(flow_ref::deref_mut(self));
base.abs_descendants = abs_descendants;
for descendant_link in base.abs_descendants.iter() {
let descendant_base = mut_base(descendant_link);