Remove unnecessary deref()s (fixes #3586)

This commit is contained in:
Tim Taubert 2014-10-09 13:12:02 +02:00
parent 15b508ac10
commit 35f8270c64
30 changed files with 147 additions and 164 deletions

View file

@ -5465,7 +5465,7 @@ class GlobalGenRoots():
cast = [CGGeneric(string.Template('''pub trait ${castTraitName} {
#[inline(always)]
fn to_ref<'a, T: ${toBound}+Reflectable>(base: JSRef<'a, T>) -> Option<JSRef<'a, Self>> {
match base.deref().${checkFn}() {
match base.${checkFn}() {
true => unsafe { Some(base.transmute()) },
false => None
}
@ -5473,7 +5473,7 @@ class GlobalGenRoots():
#[inline(always)]
fn to_borrowed_ref<'a, 'b, T: ${toBound}+Reflectable>(base: &'a JSRef<'b, T>) -> Option<&'a JSRef<'b, Self>> {
match base.deref().${checkFn}() {
match base.${checkFn}() {
true => unsafe { Some(base.transmute_borrowed()) },
false => None
}