From d9b4ac81285985f384d1a9f0708ba54434b7f231 Mon Sep 17 00:00:00 2001 From: Dawer <7803845+iDawer@users.noreply.github.com> Date: Thu, 6 May 2021 10:07:06 +0500 Subject: [PATCH] Clean up --- crates/syntax/src/ast/node_ext.rs | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/crates/syntax/src/ast/node_ext.rs b/crates/syntax/src/ast/node_ext.rs index 8e6d7b092f1..88f9a0e978f 100644 --- a/crates/syntax/src/ast/node_ext.rs +++ b/crates/syntax/src/ast/node_ext.rs @@ -5,11 +5,11 @@ use itertools::Itertools; use parser::SyntaxKind; -use rowan::{GreenNodeData, GreenTokenData, NodeOrToken}; +use rowan::{GreenNodeData, GreenTokenData}; use crate::{ ast::{self, support, AstNode, AstToken, AttrsOwner, NameOwner, SyntaxNode}, - SmolStr, SyntaxElement, SyntaxToken, TokenText, T, + NodeOrToken, SmolStr, SyntaxElement, SyntaxToken, TokenText, T, }; impl ast::Lifetime { @@ -34,19 +34,6 @@ pub fn as_tuple_field(&self) -> Option { } } -fn _text_of_first_token(node: &SyntaxNode) -> Cow<'_, str> { - fn cow_map &str>(green: Cow, f: F) -> Cow { - match green { - Cow::Borrowed(green_ref) => Cow::Borrowed(f(green_ref)), - Cow::Owned(green) => Cow::Owned(f(&green).to_owned()), - } - } - - cow_map(node.green(), |green_ref| { - green_ref.children().next().and_then(NodeOrToken::into_token).unwrap().text() - }) -} - fn text_of_first_token(node: &SyntaxNode) -> TokenText<'_> { fn first_token(green_ref: &GreenNodeData) -> &GreenTokenData { green_ref.children().next().and_then(NodeOrToken::into_token).unwrap()