diff options
author | OptimalStrategy <[email protected]> | 2020-06-12 15:16:19 +0100 |
---|---|---|
committer | OptimalStrategy <[email protected]> | 2020-06-12 15:16:19 +0100 |
commit | 591b5ec2c15a83fd10da7049b5f3ea1a783d52ed (patch) | |
tree | ad80d5d5476341651351cc376ea9350b13661448 /crates/ra_ide | |
parent | 59f195a3231d9cbc3baac2c6ca8e6400311deeb7 (diff) |
simplify determining whether the field is a tuple field
Diffstat (limited to 'crates/ra_ide')
-rw-r--r-- | crates/ra_ide/src/diagnostics.rs | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/crates/ra_ide/src/diagnostics.rs b/crates/ra_ide/src/diagnostics.rs index 9cd36ad35..e1bfd72f9 100644 --- a/crates/ra_ide/src/diagnostics.rs +++ b/crates/ra_ide/src/diagnostics.rs | |||
@@ -187,11 +187,7 @@ fn check_struct_shorthand_initialization( | |||
187 | if let (Some(name_ref), Some(expr)) = (record_field.name_ref(), record_field.expr()) { | 187 | if let (Some(name_ref), Some(expr)) = (record_field.name_ref(), record_field.expr()) { |
188 | let field_name = name_ref.syntax().text().to_string(); | 188 | let field_name = name_ref.syntax().text().to_string(); |
189 | let field_expr = expr.syntax().text().to_string(); | 189 | let field_expr = expr.syntax().text().to_string(); |
190 | let field_name_is_tup_index = name_ref | 190 | let field_name_is_tup_index = name_ref.as_tuple_field().is_some(); |
191 | .syntax() | ||
192 | .first_token() | ||
193 | .map(|token| token.kind().is_literal()) | ||
194 | .unwrap_or(false); | ||
195 | if field_name == field_expr && !field_name_is_tup_index { | 191 | if field_name == field_expr && !field_name_is_tup_index { |
196 | let mut edit_builder = TextEditBuilder::default(); | 192 | let mut edit_builder = TextEditBuilder::default(); |
197 | edit_builder.delete(record_field.syntax().text_range()); | 193 | edit_builder.delete(record_field.syntax().text_range()); |