From 479235ff0b25dbac977d28475b9203e3207b117b Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 13 Aug 2020 11:47:31 +0200 Subject: Minor --- .../ra_assists/src/handlers/extract_struct_from_enum_variant.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'crates/ra_assists/src') diff --git a/crates/ra_assists/src/handlers/extract_struct_from_enum_variant.rs b/crates/ra_assists/src/handlers/extract_struct_from_enum_variant.rs index 6e9f2d0fc..b4e19b3dc 100644 --- a/crates/ra_assists/src/handlers/extract_struct_from_enum_variant.rs +++ b/crates/ra_assists/src/handlers/extract_struct_from_enum_variant.rs @@ -6,7 +6,7 @@ use rustc_hash::FxHashSet; use syntax::{ algo::find_node_at_offset, ast::{self, ArgListOwner, AstNode, NameOwner, VisibilityOwner}, - SourceFile, SyntaxNode, TextRange, TextSize, + SourceFile, TextRange, TextSize, }; use crate::{ @@ -72,7 +72,7 @@ pub(crate) fn extract_struct_from_enum_variant( } extract_struct_def( builder, - enum_ast.syntax(), + &enum_ast, &variant_name, &field_list.to_string(), start_offset, @@ -112,9 +112,10 @@ fn insert_import( Some(()) } +// FIXME: this should use strongly-typed `make`, rather than string manipulation1 fn extract_struct_def( builder: &mut AssistBuilder, - enum_ast: &SyntaxNode, + enum_: &ast::Enum, variant_name: &str, variant_list: &str, start_offset: TextSize, @@ -126,7 +127,7 @@ fn extract_struct_def( } else { "".to_string() }; - let indent = if let Some(indent) = leading_indent(enum_ast) { + let indent = if let Some(indent) = leading_indent(enum_.syntax()) { indent.to_string() } else { "".to_string() -- cgit v1.2.3