From 5043858b87229da889e20a8923357457fb32c766 Mon Sep 17 00:00:00 2001 From: QuarticCat Date: Fri, 30 Sep 2022 22:33:43 +0800 Subject: [PATCH] Remove transmute_copy --- src/diff/graph.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/diff/graph.rs b/src/diff/graph.rs index cb26973a2e..c34e58999f 100644 --- a/src/diff/graph.rs +++ b/src/diff/graph.rs @@ -7,7 +7,6 @@ use std::{ cmp::min, hash::{Hash, Hasher}, marker::PhantomData, - mem::transmute_copy, }; use strsim::normalized_levenshtein; @@ -45,7 +44,7 @@ impl<'a> SyntaxRefOrId<'a> { pub fn get_ref(&self) -> Option<&'a Syntax<'a>> { if self.is_ref() { - Some(unsafe { transmute_copy(&self.data) }) + Some(unsafe { &*(self.data as *const _) }) } else { None } @@ -230,9 +229,9 @@ pub struct EnteredDelimiter<'a> { impl<'a> From<&EnteredDelimiter<'a>> for EnteredDelimiterEnum<'a> { fn from(delim: &EnteredDelimiter<'a>) -> Self { if delim.data & 1 == 0 { - PopEither(unsafe { transmute_copy(&delim.data) }) + PopEither(unsafe { &*(delim.data as *const _) }) } else { - PopBoth(unsafe { transmute_copy(&(delim.data ^ 1)) }) + PopBoth(unsafe { &*((delim.data ^ 1) as *const _) }) } } }