diff options
-rw-r--r-- | crates/ra_assists/src/handlers/reorder_fields.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/crates/ra_assists/src/handlers/reorder_fields.rs b/crates/ra_assists/src/handlers/reorder_fields.rs index c17c1288c..1da85fcec 100644 --- a/crates/ra_assists/src/handlers/reorder_fields.rs +++ b/crates/ra_assists/src/handlers/reorder_fields.rs | |||
@@ -27,9 +27,9 @@ fn reorder_struct(ctx: AssistCtx) -> Option<Assist> { | |||
27 | 27 | ||
28 | fn field_name(r: &RecordField) -> String { | 28 | fn field_name(r: &RecordField) -> String { |
29 | r.name_ref() | 29 | r.name_ref() |
30 | .map(|name| name.syntax().text()) | 30 | .map(|name| name.syntax().text().to_string()) |
31 | .unwrap_or_else(|| r.expr().unwrap().syntax().text()) | 31 | .or_else(|| r.expr().map(|e| e.syntax().text().to_string())) |
32 | .to_string() | 32 | .unwrap_or_default() |
33 | } | 33 | } |
34 | 34 | ||
35 | fn reorder_struct_pat(ctx: AssistCtx) -> Option<Assist> { | 35 | fn reorder_struct_pat(ctx: AssistCtx) -> Option<Assist> { |