aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_assists/src
diff options
context:
space:
mode:
authorGeoffrey Copin <[email protected]>2020-04-11 11:58:20 +0100
committerGeoffrey Copin <[email protected]>2020-04-11 11:58:20 +0100
commit21443f1b4839872841d8f32e87209f2106d43ad8 (patch)
tree5a1a0cfd54e323fcde12843cf061e1aa9f7f0c93 /crates/ra_assists/src
parent730a927c5e6b382690e88f482a03701636242a2c (diff)
Remove Option unwraping
Diffstat (limited to 'crates/ra_assists/src')
-rw-r--r--crates/ra_assists/src/handlers/reorder_fields.rs6
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
28fn field_name(r: &RecordField) -> String { 28fn 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
35fn reorder_struct_pat(ctx: AssistCtx) -> Option<Assist> { 35fn reorder_struct_pat(ctx: AssistCtx) -> Option<Assist> {