mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-11 12:56:19 +00:00
misc fixes
This commit is contained in:
parent
d929121f7b
commit
69e8393963
3 changed files with 20 additions and 26 deletions
|
@ -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 {
|
||||
|
@ -445,24 +451,6 @@ mod tests {
|
|||
.all(|element| element.ancestors().any(|it| &it == edit.root())))
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[should_panic = "some replace change ranges intersect: [Replace(Node(TUPLE_EXPR@5..7), Some(Node(NAME_REF@0..8))), Replace(Node(TUPLE_EXPR@5..7), Some(Node(NAME_REF@0..8)))]"]
|
||||
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(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue