From 80fd4882d090255b92484c31312447a551110254 Mon Sep 17 00:00:00 2001 From: QuarticCat Date: Fri, 30 Sep 2022 12:51:07 +0800 Subject: [PATCH] Minor fixes --- src/diff/graph.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/diff/graph.rs b/src/diff/graph.rs index 136ad38faf..9a01db8de1 100644 --- a/src/diff/graph.rs +++ b/src/diff/graph.rs @@ -35,7 +35,7 @@ pub struct SyntaxRefOrId<'a> { phantom: PhantomData<&'a Syntax<'a>>, } -impl SyntaxRefOrId<'_> { +impl<'a> SyntaxRefOrId<'a> { pub fn is_ref(&self) -> bool { self.data & 1 == 0 } @@ -44,7 +44,7 @@ impl SyntaxRefOrId<'_> { self.data & 1 == 1 } - pub fn get_ref<'a>(&self) -> Option<&'a Syntax<'a>> { + pub fn get_ref(&self) -> Option<&'a Syntax<'a>> { if self.is_ref() { Some(unsafe { transmute_copy(&self.data) }) } else { @@ -56,7 +56,7 @@ impl SyntaxRefOrId<'_> { impl<'a> From<&'a Syntax<'a>> for SyntaxRefOrId<'a> { fn from(s: &'a Syntax<'a>) -> Self { Self { - data: unsafe { transmute_copy(&s) }, + data: s as *const _ as _, phantom: PhantomData, } }