mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-27 05:23:24 +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 {
|
fn field_name(r: &RecordField) -> String {
|
||||||
r.name_ref()
|
r.name_ref()
|
||||||
.map(|name| name.syntax().text())
|
.map(|name| name.syntax().text().to_string())
|
||||||
.unwrap_or_else(|| r.expr().unwrap().syntax().text())
|
.or_else(|| r.expr().map(|e| e.syntax().text().to_string()))
|
||||||
.to_string()
|
.unwrap_or_default()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn reorder_struct_pat(ctx: AssistCtx) -> Option<Assist> {
|
fn reorder_struct_pat(ctx: AssistCtx) -> Option<Assist> {
|
||||||
|
|
Loading…
Reference in a new issue