mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 14:21:44 +00:00
change to TextEdit
to avoid allocation and sort
rename newline to step where applicable
This commit is contained in:
parent
863ed19946
commit
e9c186e48a
3 changed files with 51 additions and 57 deletions
|
@ -69,17 +69,17 @@ pub fn arb_text_edit(text: &str) -> BoxedStrategy<TextEdit> {
|
|||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct ArbTextWithEdits {
|
||||
pub struct ArbTextWithEdit {
|
||||
pub text: String,
|
||||
pub edits: TextEdit,
|
||||
pub edit: TextEdit,
|
||||
}
|
||||
|
||||
pub fn arb_text_with_edits() -> BoxedStrategy<ArbTextWithEdits> {
|
||||
pub fn arb_text_with_edit() -> BoxedStrategy<ArbTextWithEdit> {
|
||||
let text = arb_text();
|
||||
text.prop_flat_map(|s| {
|
||||
let edits = arb_text_edit(&s);
|
||||
(Just(s), edits)
|
||||
let edit = arb_text_edit(&s);
|
||||
(Just(s), edit)
|
||||
})
|
||||
.prop_map(|(text, edits)| ArbTextWithEdits { text, edits })
|
||||
.prop_map(|(text, edit)| ArbTextWithEdit { text, edit })
|
||||
.boxed()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue