mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 15:15:24 +00:00
more idiomatic code
This commit is contained in:
parent
360167db16
commit
99e8499957
1 changed files with 6 additions and 5 deletions
|
@ -465,14 +465,15 @@ pub fn handle_rename(world: ServerWorld, params: RenameParams) -> Result<Option<
|
||||||
.into());
|
.into());
|
||||||
}
|
}
|
||||||
|
|
||||||
let change = world
|
let optional_change = world
|
||||||
.analysis()
|
.analysis()
|
||||||
.rename(FilePosition { file_id, offset }, &*params.new_name)?;
|
.rename(FilePosition { file_id, offset }, &*params.new_name)?;
|
||||||
if change.is_none() {
|
let change = match optional_change {
|
||||||
return Ok(None);
|
None => return Ok(None),
|
||||||
}
|
Some(it) => it,
|
||||||
|
};
|
||||||
|
|
||||||
let source_change_req = change.unwrap().try_conv_with(&world)?;
|
let source_change_req = change.try_conv_with(&world)?;
|
||||||
|
|
||||||
Ok(Some(source_change_req.workspace_edit))
|
Ok(Some(source_change_req.workspace_edit))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue