Remove Option from Buffer edit APIs
Previously, buffer edits represented empty strings as None variants of an Option. Now, the edit logic just explicitly checks for empty strings. Co-authored-by: Keith Simmons <keith@zed.dev>
This commit is contained in:
parent
04fc1d5982
commit
e05793b52a
2 changed files with 20 additions and 25 deletions
|
@ -81,10 +81,7 @@ pub fn serialize_edit_operation(operation: &EditOperation) -> proto::operation::
|
|||
new_text: operation
|
||||
.new_text
|
||||
.iter()
|
||||
.map(|text| {
|
||||
text.as_ref()
|
||||
.map_or_else(String::new, |text| text.to_string())
|
||||
})
|
||||
.map(|text| text.to_string())
|
||||
.collect(),
|
||||
}
|
||||
}
|
||||
|
@ -250,7 +247,7 @@ pub fn deserialize_edit_operation(edit: proto::operation::Edit) -> EditOperation
|
|||
},
|
||||
version: deserialize_version(edit.version),
|
||||
ranges: edit.ranges.into_iter().map(deserialize_range).collect(),
|
||||
new_text: edit.new_text.into_iter().map(|t| Some(t.into())).collect(),
|
||||
new_text: edit.new_text.into_iter().map(Arc::from).collect(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue