Skip to content

Commit

Permalink
Remove usage of std::intrinsics::discriminant_value.
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonSapin committed Dec 20, 2016
1 parent 17a1838 commit 01442ba
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion components/style/viewport.rs
Expand Up @@ -69,7 +69,7 @@ macro_rules! declare_viewport_descriptor_inner {
const VIEWPORT_DESCRIPTOR_VARIANTS: usize = $number_of_variants;

impl ViewportDescriptor {
fn discriminant_value(&self) -> usize {
pub fn discriminant_value(&self) -> usize {
match *self {
$(
ViewportDescriptor::$assigned_variant(..) => $assigned_discriminant,
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/style/lib.rs
Expand Up @@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#![cfg(test)]
#![feature(core_intrinsics, plugin, test)]
#![feature(plugin, test)]

extern crate app_units;
extern crate cssparser;
Expand Down
6 changes: 2 additions & 4 deletions tests/unit/style/viewport.rs
Expand Up @@ -51,13 +51,11 @@ fn test_meta_viewport<F>(meta: &str, callback: F)
where F: Fn(&Vec<ViewportDescriptorDeclaration>, &str)
{
if let Some(mut rule) = ViewportRule::from_meta(meta) {
use std::intrinsics::discriminant_value;

// from_meta uses a hash-map to collect the declarations, so we need to
// sort them in a stable order for the tests
rule.declarations.sort_by(|a, b| {
let a = unsafe { discriminant_value(&a.descriptor) };
let b = unsafe { discriminant_value(&b.descriptor) };
let a = a.descriptor.discriminant_value();
let b = b.descriptor.discriminant_value();
a.cmp(&b)
});

Expand Down

0 comments on commit 01442ba

Please sign in to comment.