style: Remove unsound Atom From implementations.

Fixes #20158
This commit is contained in:
Emilio Cobos Álvarez 2018-03-19 11:06:23 +01:00
parent 52205e8483
commit 55e2cd5dc3
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
7 changed files with 85 additions and 100 deletions

View file

@ -176,7 +176,7 @@ impl Device {
context.mMedium
};
MediaType(CustomIdent(Atom::from(medium_to_use)))
MediaType(CustomIdent(unsafe { Atom::from_raw(medium_to_use) }))
}
/// Returns the current viewport size in app units.
@ -262,7 +262,7 @@ impl ToCss for Expression {
}
// NB: CssStringWriter not needed, feature names are under control.
write!(dest, "{}", Atom::from(unsafe { *self.feature.mName }))?;
write!(dest, "{}", unsafe { Atom::from_static(*self.feature.mName) })?;
if let Some(ref val) = self.value {
dest.write_str(": ")?;
@ -394,9 +394,9 @@ impl MediaExpressionValue {
}
nsMediaFeature_ValueType::eIdent => {
debug_assert_eq!(css_value.mUnit, nsCSSUnit::eCSSUnit_AtomIdent);
Some(MediaExpressionValue::Ident(Atom::from(unsafe {
*css_value.mValue.mAtom.as_ref()
})))
Some(MediaExpressionValue::Ident(unsafe {
Atom::from_raw(*css_value.mValue.mAtom.as_ref())
}))
}
nsMediaFeature_ValueType::eIntRatio => {
let array = unsafe { css_value.array_unchecked() };