summaryrefslogtreecommitdiff
path: root/helix-core/src/syntax.rs
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-03-26 02:02:32 +0000
committerBlaž Hrastnik2021-03-26 02:03:14 +0000
commitad3325db8e6dce3a10b9f8e0319ab9814c7ade1b (patch)
treeb855b4ca22fccb6eb97f011af3f26372d5c8df1c /helix-core/src/syntax.rs
parentcf0e191a6a42a2382128765dc0ff1531ad9800af (diff)
minor: Remove a few unwraps.
Diffstat (limited to 'helix-core/src/syntax.rs')
-rw-r--r--helix-core/src/syntax.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/helix-core/src/syntax.rs b/helix-core/src/syntax.rs
index a6b1cf61..42bfb855 100644
--- a/helix-core/src/syntax.rs
+++ b/helix-core/src/syntax.rs
@@ -172,7 +172,7 @@ thread_local! {
pub struct Syntax {
config: Arc<HighlightConfiguration>,
- pub(crate) root_layer: LanguageLayer,
+ root_layer: LanguageLayer,
}
fn byte_range_to_str(range: std::ops::Range<usize>, source: RopeSlice) -> Cow<str> {
@@ -251,7 +251,7 @@ impl Syntax {
//
// fn parse(language, old_tree, ranges)
//
- fn tree(&self) -> &Tree {
+ pub fn tree(&self) -> &Tree {
self.root_layer.tree()
}
//
@@ -363,7 +363,7 @@ impl LanguageLayer {
// Self { tree: None }
// }
- fn tree(&self) -> &Tree {
+ pub fn tree(&self) -> &Tree {
// TODO: no unwrap
self.tree.as_ref().unwrap()
}
@@ -1566,7 +1566,7 @@ fn test_parser() {
",
);
let syntax = Syntax::new(&source, Arc::new(config));
- let tree = syntax.root_layer.tree.unwrap();
+ let tree = syntax.tree();
let root = tree.root_node();
assert_eq!(root.kind(), "source_file");