mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 13:03:31 +00:00
Remove Option unwraping
This commit is contained in:
parent
730a927c5e
commit
21443f1b48
1 changed files with 3 additions and 3 deletions
|
@ -27,9 +27,9 @@ fn reorder_struct(ctx: AssistCtx) -> Option<Assist> {
|
|||
|
||||
fn field_name(r: &RecordField) -> String {
|
||||
r.name_ref()
|
||||
.map(|name| name.syntax().text())
|
||||
.unwrap_or_else(|| r.expr().unwrap().syntax().text())
|
||||
.to_string()
|
||||
.map(|name| name.syntax().text().to_string())
|
||||
.or_else(|| r.expr().map(|e| e.syntax().text().to_string()))
|
||||
.unwrap_or_default()
|
||||
}
|
||||
|
||||
fn reorder_struct_pat(ctx: AssistCtx) -> Option<Assist> {
|
||||
|
|
Loading…
Reference in a new issue