From 93bc009a5968c964693299263689b50b2efe9abc Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Fri, 4 Dec 2020 10:02:22 +0200 Subject: Remove the state --- crates/ide_db/src/helpers/insert_use.rs | 32 +------------------------------- 1 file changed, 1 insertion(+), 31 deletions(-) (limited to 'crates/ide_db/src') diff --git a/crates/ide_db/src/helpers/insert_use.rs b/crates/ide_db/src/helpers/insert_use.rs index 0dae9a541..040843990 100644 --- a/crates/ide_db/src/helpers/insert_use.rs +++ b/crates/ide_db/src/helpers/insert_use.rs @@ -11,7 +11,7 @@ use syntax::{ edit::{AstNodeEdit, IndentLevel}, make, AstNode, PathSegmentKind, VisibilityOwner, }, - AstToken, InsertPosition, NodeOrToken, SyntaxElement, SyntaxNode, SyntaxNodePtr, SyntaxToken, + AstToken, InsertPosition, NodeOrToken, SyntaxElement, SyntaxNode, SyntaxToken, }; use test_utils::mark; @@ -21,36 +21,6 @@ pub enum ImportScope { Module(ast::ItemList), } -impl ImportScope { - pub fn get_ptr(&self) -> ImportScopePtr { - match self { - ImportScope::File(file) => ImportScopePtr::File(SyntaxNodePtr::new(file.syntax())), - ImportScope::Module(module) => { - ImportScopePtr::Module(SyntaxNodePtr::new(module.syntax())) - } - } - } -} - -#[derive(Debug, Clone)] -pub enum ImportScopePtr { - File(SyntaxNodePtr), - Module(SyntaxNodePtr), -} - -impl ImportScopePtr { - pub fn into_scope(self, root: &SyntaxNode) -> Option { - Some(match self { - ImportScopePtr::File(file_ptr) => { - ImportScope::File(ast::SourceFile::cast(file_ptr.to_node(root))?) - } - ImportScopePtr::Module(module_ptr) => { - ImportScope::File(ast::SourceFile::cast(module_ptr.to_node(root))?) - } - }) - } -} - impl ImportScope { pub fn from(syntax: SyntaxNode) -> Option { if let Some(module) = ast::Module::cast(syntax.clone()) { -- cgit v1.2.3