Skip to content

Commit

Permalink
Auto merge of #15707 - froydnj:geckolib-transmute-removal, r=Wafflesp…
Browse files Browse the repository at this point in the history
…eanut

geckolib: remove std::mem::transmute usages

We can make these look nicer with the FFIArcHelpers trait.

I think there are tests for these changes?  Not sure.

<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [ ] These changes fix #__ (github issue number if applicable).

<!-- Either: -->
- [X] There are tests for these changes OR
- [ ] These changes do not require tests because ____

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15707)
<!-- Reviewable:end -->
  • Loading branch information
bors-servo committed Feb 23, 2017
2 parents 56a9957 + b1f8f03 commit 063aec5
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions ports/geckolib/glue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ use std::borrow::Cow;
use std::cmp;
use std::env;
use std::fmt::Write;
use std::mem;
use std::ptr;
use std::sync::{Arc, Mutex};
use style::arc_ptr_eq;
Expand Down Expand Up @@ -395,12 +394,10 @@ pub extern "C" fn Servo_StyleSheet_Empty(mode: SheetParsingMode) -> RawServoStyl
SheetParsingMode::eUserSheetFeatures => Origin::User,
SheetParsingMode::eAgentSheetFeatures => Origin::UserAgent,
};
let sheet = Arc::new(Stylesheet::from_str(
Arc::new(Stylesheet::from_str(
"", url, origin, Default::default(), None,
Box::new(StdoutErrorReporter), extra_data));
unsafe {
mem::transmute(sheet)
}
Box::new(StdoutErrorReporter), extra_data)
).into_strong()
}

#[no_mangle]
Expand Down Expand Up @@ -440,12 +437,10 @@ pub extern "C" fn Servo_StyleSheet_FromUTF8Bytes(loader: *mut Loader,
Some(ref s) => Some(s),
};

let sheet = Arc::new(Stylesheet::from_str(
Arc::new(Stylesheet::from_str(
input, url, origin, Default::default(), loader,
Box::new(StdoutErrorReporter), extra_data));
unsafe {
mem::transmute(sheet)
}
Box::new(StdoutErrorReporter), extra_data)
).into_strong()
}

#[no_mangle]
Expand Down Expand Up @@ -1304,7 +1299,7 @@ pub extern "C" fn Servo_ImportRule_GetSheet(import_rule:
RawServoImportRuleBorrowed)
-> RawServoStyleSheetStrong {
let import_rule = RwLock::<ImportRule>::as_arc(&import_rule);
unsafe { mem::transmute(import_rule.read().stylesheet.clone()) }
import_rule.read().stylesheet.clone().into_strong()
}

#[no_mangle]
Expand Down

0 comments on commit 063aec5

Please sign in to comment.