Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/syntax/src/syntax_editor.rs')
| -rw-r--r-- | crates/syntax/src/syntax_editor.rs | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/crates/syntax/src/syntax_editor.rs b/crates/syntax/src/syntax_editor.rs index 3a05cc480b..139c6518bf 100644 --- a/crates/syntax/src/syntax_editor.rs +++ b/crates/syntax/src/syntax_editor.rs @@ -150,6 +150,12 @@ impl SyntaxAnnotation { } } +impl Default for SyntaxAnnotation { + fn default() -> Self { + Self::new() + } +} + /// Position describing where to insert elements #[derive(Debug)] pub struct Position { @@ -446,24 +452,6 @@ mod tests { } #[test] - #[should_panic = "some replace change ranges intersect: [Replace(Node([email protected]), Some(Node([email protected]))), Replace(Node([email protected]), Some(Node([email protected])))]"] - fn fail_on_non_disjoint_single_replace() { - let root = make::match_arm([make::wildcard_pat().into()], None, make::expr_tuple([])); - - let to_wrap = root.syntax().descendants().find_map(ast::TupleExpr::cast).unwrap(); - - let mut editor = SyntaxEditor::new(root.syntax().clone()); - - let name_ref = make::name_ref("var_name").clone_for_update(); - - // should die, ranges are not disjoint - editor.replace(to_wrap.syntax(), name_ref.syntax()); - editor.replace(to_wrap.syntax(), name_ref.syntax()); - - let _ = editor.finish(); - } - - #[test] fn test_insert_independent() { let root = make::block_expr( [make::let_stmt( |