aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGygaxis Vainhardt2021-10-28 01:24:11 +0000
committerGitHub2021-10-28 01:24:11 +0000
commit0a38983ee3d4a38a026dfb44ae9cd99f66145d3d (patch)
tree818baa5da0df7d47aa0b8a6c87a55fc9308b6345
parente2ed6915373adf27881325ebc4e2c6b98e207af3 (diff)
Remove three transmutes from helix-core syntax.rs (#923)
-rw-r--r--helix-core/src/syntax.rs9
1 files changed, 4 insertions, 5 deletions
diff --git a/helix-core/src/syntax.rs b/helix-core/src/syntax.rs
index 281a70f9..f3e3f238 100644
--- a/helix-core/src/syntax.rs
+++ b/helix-core/src/syntax.rs
@@ -437,7 +437,7 @@ impl Syntax {
/// Iterate over the highlighted regions for a given slice of source code.
pub fn highlight_iter<'a>(
- &self,
+ &'a self,
source: RopeSlice<'a>,
range: Option<std::ops::Range<usize>>,
cancellation_flag: Option<&'a AtomicUsize>,
@@ -452,11 +452,10 @@ impl Syntax {
let highlighter = &mut ts_parser.borrow_mut();
highlighter.cursors.pop().unwrap_or_else(QueryCursor::new)
});
- let tree_ref = unsafe { mem::transmute::<_, &'static Tree>(self.tree()) };
+ let tree_ref = self.tree();
let cursor_ref = unsafe { mem::transmute::<_, &'static mut QueryCursor>(&mut cursor) };
- let query_ref = unsafe { mem::transmute::<_, &'static Query>(&self.config.query) };
- let config_ref =
- unsafe { mem::transmute::<_, &'static HighlightConfiguration>(self.config.as_ref()) };
+ let query_ref = &self.config.query;
+ let config_ref = self.config.as_ref();
// if reusing cursors & no range this resets to whole range
cursor_ref.set_byte_range(range.clone().unwrap_or(0..usize::MAX));