Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rowan"
version = "0.15.19"
version = "0.17.0"
authors = ["Aleksey Kladov <aleksey.kladov@gmail.com>"]
repository = "https://github.com/rust-analyzer/rowan"
license = "MIT OR Apache-2.0"
Expand Down
31 changes: 2 additions & 29 deletions src/api.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::{borrow::Cow, fmt, iter, marker::PhantomData, ops::Range};
use std::{fmt, iter, marker::PhantomData};

use crate::{
cursor, green::GreenTokenData, Direction, GreenNode, GreenNodeData, GreenToken, NodeOrToken,
Expand Down Expand Up @@ -121,7 +121,7 @@ impl<L: Language> SyntaxNode<L> {
self.raw.text()
}

pub fn green(&self) -> Cow<'_, GreenNodeData> {
pub fn green(&self) -> &GreenNodeData {
self.raw.green()
}

Expand Down Expand Up @@ -243,23 +243,6 @@ impl<L: Language> SyntaxNode<L> {
pub fn clone_subtree(&self) -> SyntaxNode<L> {
SyntaxNode::from(self.raw.clone_subtree())
}

pub fn clone_for_update(&self) -> SyntaxNode<L> {
SyntaxNode::from(self.raw.clone_for_update())
}

pub fn is_mutable(&self) -> bool {
self.raw.is_mutable()
}

pub fn detach(&self) {
self.raw.detach()
}

pub fn splice_children(&self, to_delete: Range<usize>, to_insert: Vec<SyntaxElement<L>>) {
let to_insert = to_insert.into_iter().map(cursor::SyntaxElement::from).collect::<Vec<_>>();
self.raw.splice_children(to_delete, to_insert)
}
}

impl<L: Language> SyntaxToken<L> {
Expand Down Expand Up @@ -331,10 +314,6 @@ impl<L: Language> SyntaxToken<L> {
pub fn prev_token(&self) -> Option<SyntaxToken<L>> {
self.raw.prev_token().map(SyntaxToken::from)
}

pub fn detach(&self) {
self.raw.detach()
}
}

impl<L: Language> SyntaxElement<L> {
Expand Down Expand Up @@ -393,12 +372,6 @@ impl<L: Language> SyntaxElement<L> {
NodeOrToken::Token(it) => it.prev_sibling_or_token(),
}
}
pub fn detach(&self) {
match self {
NodeOrToken::Node(it) => it.detach(),
NodeOrToken::Token(it) => it.detach(),
}
}
}

#[derive(Debug, Clone)]
Expand Down
7 changes: 0 additions & 7 deletions src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,6 @@ pub trait AstNode {

fn syntax(&self) -> &SyntaxNode<Self::Language>;

fn clone_for_update(&self) -> Self
where
Self: Sized,
{
Self::cast(self.syntax().clone_for_update()).unwrap()
}

fn clone_subtree(&self) -> Self
where
Self: Sized,
Expand Down
Loading
Loading