add fix for removing unnecessary braces in use statements

This commit is contained in:
gfreezy 2018-12-26 00:45:13 +08:00
parent 5fb426cb9e
commit 72eb9de747
5 changed files with 69 additions and 62 deletions

View file

@ -288,19 +288,18 @@ impl Analysis {
}
pub fn join_lines(&self, file_id: FileId, range: TextRange) -> SourceChange {
let file = self.imp.file_syntax(file_id);
SourceChange::from_local_edit(file_id, "join lines", ra_editor::join_lines(&file, range))
SourceChange::from_local_edit(file_id, ra_editor::join_lines(&file, range))
}
pub fn on_enter(&self, position: FilePosition) -> Option<SourceChange> {
let file = self.imp.file_syntax(position.file_id);
let edit = ra_editor::on_enter(&file, position.offset)?;
let res = SourceChange::from_local_edit(position.file_id, "on enter", edit);
let res = SourceChange::from_local_edit(position.file_id, edit);
Some(res)
}
pub fn on_eq_typed(&self, position: FilePosition) -> Option<SourceChange> {
let file = self.imp.file_syntax(position.file_id);
Some(SourceChange::from_local_edit(
position.file_id,
"add semicolon",
ra_editor::on_eq_typed(&file, position.offset)?,
))
}