From 65fa5864105280267e6ccdaa61957cd9953e444e Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 20 May 2020 22:55:37 +0200 Subject: Relax cursor position tests in assists Those will be replaced with snippets anyway --- .../ra_assists/src/handlers/add_explicit_type.rs | 18 ++++------ .../src/handlers/add_from_impl_for_enum.rs | 6 ++-- crates/ra_assists/src/handlers/apply_demorgan.rs | 8 ++--- crates/ra_assists/src/handlers/auto_import.rs | 22 ++++++------- .../ra_assists/src/handlers/change_visibility.rs | 30 ++++++++--------- crates/ra_assists/src/handlers/flip_binexpr.rs | 14 +++----- crates/ra_assists/src/handlers/flip_comma.rs | 2 +- crates/ra_assists/src/handlers/flip_trait_bound.rs | 14 ++++---- crates/ra_assists/src/handlers/invert_if.rs | 6 ++-- crates/ra_assists/src/handlers/move_bounds.rs | 8 ++--- crates/ra_assists/src/handlers/raw_string.rs | 26 +++++++-------- crates/ra_assists/src/handlers/reorder_fields.rs | 6 ++-- .../handlers/replace_qualified_name_with_use.rs | 38 +++++++++++----------- crates/ra_assists/src/tests.rs | 15 ++------- 14 files changed, 96 insertions(+), 117 deletions(-) (limited to 'crates/ra_assists/src') diff --git a/crates/ra_assists/src/handlers/add_explicit_type.rs b/crates/ra_assists/src/handlers/add_explicit_type.rs index 770049212..ab20c6649 100644 --- a/crates/ra_assists/src/handlers/add_explicit_type.rs +++ b/crates/ra_assists/src/handlers/add_explicit_type.rs @@ -86,11 +86,7 @@ mod tests { #[test] fn add_explicit_type_works_for_simple_expr() { - check_assist( - add_explicit_type, - "fn f() { let a<|> = 1; }", - "fn f() { let a<|>: i32 = 1; }", - ); + check_assist(add_explicit_type, "fn f() { let a<|> = 1; }", "fn f() { let a: i32 = 1; }"); } #[test] @@ -98,7 +94,7 @@ mod tests { check_assist( add_explicit_type, "fn f() { let a<|>: _ = 1; }", - "fn f() { let a<|>: i32 = 1; }", + "fn f() { let a: i32 = 1; }", ); } @@ -122,7 +118,7 @@ mod tests { } fn f() { - let a<|>: Option = Option::Some(1); + let a: Option = Option::Some(1); }"#, ); } @@ -132,7 +128,7 @@ mod tests { check_assist( add_explicit_type, r"macro_rules! v { () => {0u64} } fn f() { let a<|> = v!(); }", - r"macro_rules! v { () => {0u64} } fn f() { let a<|>: u64 = v!(); }", + r"macro_rules! v { () => {0u64} } fn f() { let a: u64 = v!(); }", ); } @@ -140,8 +136,8 @@ mod tests { fn add_explicit_type_works_for_macro_call_recursive() { check_assist( add_explicit_type, - "macro_rules! u { () => {0u64} } macro_rules! v { () => {u!()} } fn f() { let a<|> = v!(); }", - "macro_rules! u { () => {0u64} } macro_rules! v { () => {u!()} } fn f() { let a<|>: u64 = v!(); }", + r#"macro_rules! u { () => {0u64} } macro_rules! v { () => {u!()} } fn f() { let a<|> = v!(); }"#, + r#"macro_rules! u { () => {0u64} } macro_rules! v { () => {u!()} } fn f() { let a: u64 = v!(); }"#, ); } @@ -208,7 +204,7 @@ struct Test { } fn main() { - let test<|>: Test = Test { t: 23, k: 33 }; + let test: Test = Test { t: 23, k: 33 }; }"#, ); } diff --git a/crates/ra_assists/src/handlers/add_from_impl_for_enum.rs b/crates/ra_assists/src/handlers/add_from_impl_for_enum.rs index 5f6c8b19a..6a675e812 100644 --- a/crates/ra_assists/src/handlers/add_from_impl_for_enum.rs +++ b/crates/ra_assists/src/handlers/add_from_impl_for_enum.rs @@ -101,7 +101,7 @@ mod tests { check_assist( add_from_impl_for_enum, "enum A { <|>One(u32) }", - r#"enum A { <|>One(u32) } + r#"enum A { One(u32) } impl From for A { fn from(v: u32) -> Self { @@ -116,7 +116,7 @@ impl From for A { check_assist( add_from_impl_for_enum, r#"enum A { <|>One(foo::bar::baz::Boo) }"#, - r#"enum A { <|>One(foo::bar::baz::Boo) } + r#"enum A { One(foo::bar::baz::Boo) } impl From for A { fn from(v: foo::bar::baz::Boo) -> Self { @@ -178,7 +178,7 @@ impl From for A { pub trait From { fn from(T) -> Self; }"#, - r#"enum A { <|>One(u32), Two(String), } + r#"enum A { One(u32), Two(String), } impl From for A { fn from(v: u32) -> Self { diff --git a/crates/ra_assists/src/handlers/apply_demorgan.rs b/crates/ra_assists/src/handlers/apply_demorgan.rs index 0feba5e11..233e8fb8e 100644 --- a/crates/ra_assists/src/handlers/apply_demorgan.rs +++ b/crates/ra_assists/src/handlers/apply_demorgan.rs @@ -63,22 +63,22 @@ mod tests { #[test] fn demorgan_turns_and_into_or() { - check_assist(apply_demorgan, "fn f() { !x &&<|> !x }", "fn f() { !(x ||<|> x) }") + check_assist(apply_demorgan, "fn f() { !x &&<|> !x }", "fn f() { !(x || x) }") } #[test] fn demorgan_turns_or_into_and() { - check_assist(apply_demorgan, "fn f() { !x ||<|> !x }", "fn f() { !(x &&<|> x) }") + check_assist(apply_demorgan, "fn f() { !x ||<|> !x }", "fn f() { !(x && x) }") } #[test] fn demorgan_removes_inequality() { - check_assist(apply_demorgan, "fn f() { x != x ||<|> !x }", "fn f() { !(x == x &&<|> x) }") + check_assist(apply_demorgan, "fn f() { x != x ||<|> !x }", "fn f() { !(x == x && x) }") } #[test] fn demorgan_general_case() { - check_assist(apply_demorgan, "fn f() { x ||<|> x }", "fn f() { !(!x &&<|> !x) }") + check_assist(apply_demorgan, "fn f() { x ||<|> x }", "fn f() { !(!x && !x) }") } #[test] diff --git a/crates/ra_assists/src/handlers/auto_import.rs b/crates/ra_assists/src/handlers/auto_import.rs index f6d25579e..edf96d50e 100644 --- a/crates/ra_assists/src/handlers/auto_import.rs +++ b/crates/ra_assists/src/handlers/auto_import.rs @@ -298,7 +298,7 @@ mod tests { } ", r" - <|>use PubMod::PubStruct; + use PubMod::PubStruct; PubStruct @@ -329,7 +329,7 @@ mod tests { macro_rules! foo { ($i:ident) => { fn foo(a: $i) {} } } - foo!(Pub<|>Struct); + foo!(PubStruct); pub mod PubMod { pub struct PubStruct; @@ -360,7 +360,7 @@ mod tests { use PubMod::{PubStruct2, PubStruct1}; struct Test { - test: Pub<|>Struct2, + test: PubStruct2, } pub mod PubMod { @@ -393,7 +393,7 @@ mod tests { r" use PubMod3::PubStruct; - PubSt<|>ruct + PubStruct pub mod PubMod1 { pub struct PubStruct; @@ -474,7 +474,7 @@ mod tests { r" use PubMod::test_function; - test_function<|> + test_function pub mod PubMod { pub fn test_function() {}; @@ -501,7 +501,7 @@ mod tests { r"use crate_with_macro::foo; fn main() { - foo<|> + foo } ", ); @@ -587,7 +587,7 @@ fn main() { } fn main() { - TestStruct::test_function<|> + TestStruct::test_function } ", ); @@ -620,7 +620,7 @@ fn main() { } fn main() { - TestStruct::TEST_CONST<|> + TestStruct::TEST_CONST } ", ); @@ -659,7 +659,7 @@ fn main() { } fn main() { - test_mod::TestStruct::test_function<|> + test_mod::TestStruct::test_function } ", ); @@ -730,7 +730,7 @@ fn main() { } fn main() { - test_mod::TestStruct::TEST_CONST<|> + test_mod::TestStruct::TEST_CONST } ", ); @@ -803,7 +803,7 @@ fn main() { fn main() { let test_struct = test_mod::TestStruct {}; - test_struct.test_meth<|>od() + test_struct.test_method() } ", ); diff --git a/crates/ra_assists/src/handlers/change_visibility.rs b/crates/ra_assists/src/handlers/change_visibility.rs index fbe459c9c..c21d75be0 100644 --- a/crates/ra_assists/src/handlers/change_visibility.rs +++ b/crates/ra_assists/src/handlers/change_visibility.rs @@ -118,17 +118,13 @@ mod tests { #[test] fn change_visibility_adds_pub_crate_to_items() { - check_assist(change_visibility, "<|>fn foo() {}", "<|>pub(crate) fn foo() {}"); - check_assist(change_visibility, "f<|>n foo() {}", "pub(crate) f<|>n foo() {}"); - check_assist(change_visibility, "<|>struct Foo {}", "<|>pub(crate) struct Foo {}"); - check_assist(change_visibility, "<|>mod foo {}", "<|>pub(crate) mod foo {}"); - check_assist(change_visibility, "<|>trait Foo {}", "<|>pub(crate) trait Foo {}"); - check_assist(change_visibility, "m<|>od {}", "pub(crate) m<|>od {}"); - check_assist( - change_visibility, - "unsafe f<|>n foo() {}", - "pub(crate) unsafe f<|>n foo() {}", - ); + check_assist(change_visibility, "<|>fn foo() {}", "pub(crate) fn foo() {}"); + check_assist(change_visibility, "f<|>n foo() {}", "pub(crate) fn foo() {}"); + check_assist(change_visibility, "<|>struct Foo {}", "pub(crate) struct Foo {}"); + check_assist(change_visibility, "<|>mod foo {}", "pub(crate) mod foo {}"); + check_assist(change_visibility, "<|>trait Foo {}", "pub(crate) trait Foo {}"); + check_assist(change_visibility, "m<|>od {}", "pub(crate) mod {}"); + check_assist(change_visibility, "unsafe f<|>n foo() {}", "pub(crate) unsafe fn foo() {}"); } #[test] @@ -136,9 +132,9 @@ mod tests { check_assist( change_visibility, r"struct S { <|>field: u32 }", - r"struct S { <|>pub(crate) field: u32 }", + r"struct S { pub(crate) field: u32 }", ); - check_assist(change_visibility, r"struct S ( <|>u32 )", r"struct S ( <|>pub(crate) u32 )"); + check_assist(change_visibility, r"struct S ( <|>u32 )", r"struct S ( pub(crate) u32 )"); } #[test] @@ -152,17 +148,17 @@ mod tests { #[test] fn change_visibility_pub_to_pub_crate() { - check_assist(change_visibility, "<|>pub fn foo() {}", "<|>pub(crate) fn foo() {}") + check_assist(change_visibility, "<|>pub fn foo() {}", "pub(crate) fn foo() {}") } #[test] fn change_visibility_pub_crate_to_pub() { - check_assist(change_visibility, "<|>pub(crate) fn foo() {}", "<|>pub fn foo() {}") + check_assist(change_visibility, "<|>pub(crate) fn foo() {}", "pub fn foo() {}") } #[test] fn change_visibility_const() { - check_assist(change_visibility, "<|>const FOO = 3u8;", "<|>pub(crate) const FOO = 3u8;"); + check_assist(change_visibility, "<|>const FOO = 3u8;", "pub(crate) const FOO = 3u8;"); } #[test] @@ -183,7 +179,7 @@ mod tests { // comments #[derive(Debug)] - <|>pub(crate) struct Foo; + pub(crate) struct Foo; ", ) } diff --git a/crates/ra_assists/src/handlers/flip_binexpr.rs b/crates/ra_assists/src/handlers/flip_binexpr.rs index 692ba4895..573196576 100644 --- a/crates/ra_assists/src/handlers/flip_binexpr.rs +++ b/crates/ra_assists/src/handlers/flip_binexpr.rs @@ -85,17 +85,13 @@ mod tests { check_assist( flip_binexpr, "fn f() { let res = 1 ==<|> 2; }", - "fn f() { let res = 2 ==<|> 1; }", + "fn f() { let res = 2 == 1; }", ) } #[test] fn flip_binexpr_works_for_gt() { - check_assist( - flip_binexpr, - "fn f() { let res = 1 ><|> 2; }", - "fn f() { let res = 2 <<|> 1; }", - ) + check_assist(flip_binexpr, "fn f() { let res = 1 ><|> 2; }", "fn f() { let res = 2 < 1; }") } #[test] @@ -103,7 +99,7 @@ mod tests { check_assist( flip_binexpr, "fn f() { let res = 1 <=<|> 2; }", - "fn f() { let res = 2 >=<|> 1; }", + "fn f() { let res = 2 >= 1; }", ) } @@ -112,7 +108,7 @@ mod tests { check_assist( flip_binexpr, "fn f() { let res = (1 + 1) ==<|> (2 + 2); }", - "fn f() { let res = (2 + 2) ==<|> (1 + 1); }", + "fn f() { let res = (2 + 2) == (1 + 1); }", ) } @@ -132,7 +128,7 @@ mod tests { fn dyn_eq(&self, other: &dyn Diagnostic) -> bool { match other.downcast_ref::() { None => false, - Some(it) => self ==<|> it, + Some(it) => self == it, } } "#, diff --git a/crates/ra_assists/src/handlers/flip_comma.rs b/crates/ra_assists/src/handlers/flip_comma.rs index dfe2a7fed..a57a1c463 100644 --- a/crates/ra_assists/src/handlers/flip_comma.rs +++ b/crates/ra_assists/src/handlers/flip_comma.rs @@ -45,7 +45,7 @@ mod tests { check_assist( flip_comma, "fn foo(x: i32,<|> y: Result<(), ()>) {}", - "fn foo(y: Result<(), ()>,<|> x: i32) {}", + "fn foo(y: Result<(), ()>, x: i32) {}", ) } diff --git a/crates/ra_assists/src/handlers/flip_trait_bound.rs b/crates/ra_assists/src/handlers/flip_trait_bound.rs index 8a08702ab..0115adc8b 100644 --- a/crates/ra_assists/src/handlers/flip_trait_bound.rs +++ b/crates/ra_assists/src/handlers/flip_trait_bound.rs @@ -60,7 +60,7 @@ mod tests { check_assist( flip_trait_bound, "struct S where T: A <|>+ B { }", - "struct S where T: B <|>+ A { }", + "struct S where T: B + A { }", ) } @@ -69,13 +69,13 @@ mod tests { check_assist( flip_trait_bound, "impl X for S where T: A +<|> B { }", - "impl X for S where T: B +<|> A { }", + "impl X for S where T: B + A { }", ) } #[test] fn flip_trait_bound_works_for_fn() { - check_assist(flip_trait_bound, "fn f+ B>(t: T) { }", "fn f+ A>(t: T) { }") + check_assist(flip_trait_bound, "fn f+ B>(t: T) { }", "fn f(t: T) { }") } #[test] @@ -83,7 +83,7 @@ mod tests { check_assist( flip_trait_bound, "fn f(t: T) where T: A +<|> B { }", - "fn f(t: T) where T: B +<|> A { }", + "fn f(t: T) where T: B + A { }", ) } @@ -92,7 +92,7 @@ mod tests { check_assist( flip_trait_bound, "fn f(t: T) where T: A <|>+ 'static { }", - "fn f(t: T) where T: 'static <|>+ A { }", + "fn f(t: T) where T: 'static + A { }", ) } @@ -101,7 +101,7 @@ mod tests { check_assist( flip_trait_bound, "struct S where T: A <|>+ b_mod::B + C { }", - "struct S where T: b_mod::B <|>+ A + C { }", + "struct S where T: b_mod::B + A + C { }", ) } @@ -110,7 +110,7 @@ mod tests { check_assist( flip_trait_bound, "struct S where T: A + B + C + D + E + F +<|> G + H + I + J { }", - "struct S where T: A + B + C + D + E + G +<|> F + H + I + J { }", + "struct S where T: A + B + C + D + E + G + F + H + I + J { }", ) } } diff --git a/crates/ra_assists/src/handlers/invert_if.rs b/crates/ra_assists/src/handlers/invert_if.rs index 527c7caef..59d278eb9 100644 --- a/crates/ra_assists/src/handlers/invert_if.rs +++ b/crates/ra_assists/src/handlers/invert_if.rs @@ -72,7 +72,7 @@ mod tests { check_assist( invert_if, "fn f() { i<|>f x != 3 { 1 } else { 3 + 2 } }", - "fn f() { i<|>f x == 3 { 3 + 2 } else { 1 } }", + "fn f() { if x == 3 { 3 + 2 } else { 1 } }", ) } @@ -81,7 +81,7 @@ mod tests { check_assist( invert_if, "fn f() { <|>if !cond { 3 * 2 } else { 1 } }", - "fn f() { <|>if cond { 1 } else { 3 * 2 } }", + "fn f() { if cond { 1 } else { 3 * 2 } }", ) } @@ -90,7 +90,7 @@ mod tests { check_assist( invert_if, "fn f() { i<|>f cond { 3 * 2 } else { 1 } }", - "fn f() { i<|>f !cond { 1 } else { 3 * 2 } }", + "fn f() { if !cond { 1 } else { 3 * 2 } }", ) } diff --git a/crates/ra_assists/src/handlers/move_bounds.rs b/crates/ra_assists/src/handlers/move_bounds.rs index a41aacfc3..be2a7eddc 100644 --- a/crates/ra_assists/src/handlers/move_bounds.rs +++ b/crates/ra_assists/src/handlers/move_bounds.rs @@ -99,7 +99,7 @@ mod tests { fn fooF: FnOnce(T) -> T>() {} "#, r#" - fn fooF>() where T: u32, F: FnOnce(T) -> T {} + fn foo() where T: u32, F: FnOnce(T) -> T {} "#, ); } @@ -112,7 +112,7 @@ mod tests { implT> A {} "#, r#" - implT> A where U: u32 {} + impl A where U: u32 {} "#, ); } @@ -125,7 +125,7 @@ mod tests { struct A<<|>T: Iterator> {} "#, r#" - struct A<<|>T> where T: Iterator {} + struct A where T: Iterator {} "#, ); } @@ -138,7 +138,7 @@ mod tests { struct Pair<<|>T: u32>(T, T); "#, r#" - struct Pair<<|>T>(T, T) where T: u32; + struct Pair(T, T) where T: u32; "#, ); } diff --git a/crates/ra_assists/src/handlers/raw_string.rs b/crates/ra_assists/src/handlers/raw_string.rs index c20ffe0b3..16002d2ac 100644 --- a/crates/ra_assists/src/handlers/raw_string.rs +++ b/crates/ra_assists/src/handlers/raw_string.rs @@ -164,7 +164,7 @@ mod test { "#, r##" fn f() { - let s = <|>r#"random + let s = r#"random string"#; } "##, @@ -182,7 +182,7 @@ string"#; "#, r##" fn f() { - format!(<|>r#"x = {}"#, 92) + format!(r#"x = {}"#, 92) } "##, ) @@ -199,7 +199,7 @@ string"#; "###, r####" fn f() { - let s = <|>r#"#random## + let s = r#"#random## string"#; } "####, @@ -217,7 +217,7 @@ string"#; "###, r####" fn f() { - let s = <|>r###"#random"## + let s = r###"#random"## string"###; } "####, @@ -235,7 +235,7 @@ string"###; "#, r##" fn f() { - let s = <|>r#"random string"#; + let s = r#"random string"#; } "##, ) @@ -289,7 +289,7 @@ string"###; "#, r##" fn f() { - let s = <|>r#"random string"#; + let s = r#"random string"#; } "##, ) @@ -306,7 +306,7 @@ string"###; "##, r###" fn f() { - let s = <|>r##"random"string"##; + let s = r##"random"string"##; } "###, ) @@ -348,7 +348,7 @@ string"###; "##, r#" fn f() { - let s = <|>r"random string"; + let s = r"random string"; } "#, ) @@ -365,7 +365,7 @@ string"###; "##, r#" fn f() { - let s = <|>r"random\"str\"ing"; + let s = r"random\"str\"ing"; } "#, ) @@ -382,7 +382,7 @@ string"###; "###, r##" fn f() { - let s = <|>r#"random string"#; + let s = r#"random string"#; } "##, ) @@ -436,7 +436,7 @@ string"###; "##, r#" fn f() { - let s = <|>"random string"; + let s = "random string"; } "#, ) @@ -453,7 +453,7 @@ string"###; "##, r#" fn f() { - let s = <|>"random\"str\"ing"; + let s = "random\"str\"ing"; } "#, ) @@ -470,7 +470,7 @@ string"###; "###, r##" fn f() { - let s = <|>"random string"; + let s = "random string"; } "##, ) diff --git a/crates/ra_assists/src/handlers/reorder_fields.rs b/crates/ra_assists/src/handlers/reorder_fields.rs index 757f6406e..30229edc2 100644 --- a/crates/ra_assists/src/handlers/reorder_fields.rs +++ b/crates/ra_assists/src/handlers/reorder_fields.rs @@ -140,7 +140,7 @@ mod tests { "#, r#" struct Foo {foo: i32, bar: i32}; - const test: Foo = <|>Foo {foo: 1, bar: 0} + const test: Foo = Foo {foo: 1, bar: 0} "#, ) } @@ -164,7 +164,7 @@ mod tests { fn f(f: Foo) -> { match f { - <|>Foo { ref mut bar, baz: 0, .. } => (), + Foo { ref mut bar, baz: 0, .. } => (), _ => () } } @@ -202,7 +202,7 @@ mod tests { impl Foo { fn new() -> Foo { let foo = String::new(); - <|>Foo { + Foo { foo, bar: foo.clone(), extra: "Extra field", diff --git a/crates/ra_assists/src/handlers/replace_qualified_name_with_use.rs b/crates/ra_assists/src/handlers/replace_qualified_name_with_use.rs index d9f84208d..0197a8cf0 100644 --- a/crates/ra_assists/src/handlers/replace_qualified_name_with_use.rs +++ b/crates/ra_assists/src/handlers/replace_qualified_name_with_use.rs @@ -89,7 +89,7 @@ std::fmt::Debug<|> " use std::fmt::Debug; -Debug<|> +Debug ", ); } @@ -106,7 +106,7 @@ fn main() { " use std::fmt::Debug; -Debug<|> +Debug fn main() { } @@ -130,7 +130,7 @@ use std::fmt::Debug; fn main() { } -Debug<|> +Debug ", ); } @@ -145,7 +145,7 @@ std::fmt<|>::Debug " use std::fmt; -fmt<|>::Debug +fmt::Debug ", ); } @@ -164,7 +164,7 @@ impl std::fmt::Debug<|> for Foo { use stdx; use std::fmt::Debug; -impl Debug<|> for Foo { +impl Debug for Foo { } ", ); @@ -181,7 +181,7 @@ impl std::fmt::Debug<|> for Foo { " use std::fmt::Debug; -impl Debug<|> for Foo { +impl Debug for Foo { } ", ); @@ -198,7 +198,7 @@ impl Debug<|> for Foo { " use std::fmt::Debug; - impl Debug<|> for Foo { + impl Debug for Foo { } ", ); @@ -217,7 +217,7 @@ impl std::io<|> for Foo { " use std::{io, fmt}; -impl io<|> for Foo { +impl io for Foo { } ", ); @@ -236,7 +236,7 @@ impl std::fmt::Debug<|> for Foo { " use std::fmt::{self, Debug, }; -impl Debug<|> for Foo { +impl Debug for Foo { } ", ); @@ -255,7 +255,7 @@ impl std::fmt<|> for Foo { " use std::fmt::{self, Debug}; -impl fmt<|> for Foo { +impl fmt for Foo { } ", ); @@ -274,7 +274,7 @@ impl std::fmt::nested<|> for Foo { " use std::fmt::{Debug, nested::{Display, self}}; -impl nested<|> for Foo { +impl nested for Foo { } ", ); @@ -293,7 +293,7 @@ impl std::fmt::nested<|> for Foo { " use std::fmt::{Debug, nested::{self, Display}}; -impl nested<|> for Foo { +impl nested for Foo { } ", ); @@ -312,7 +312,7 @@ impl std::fmt::nested::Debug<|> for Foo { " use std::fmt::{Debug, nested::{Display, Debug}}; -impl Debug<|> for Foo { +impl Debug for Foo { } ", ); @@ -331,7 +331,7 @@ impl std::fmt::nested::Display<|> for Foo { " use std::fmt::{nested::Display, Debug}; -impl Display<|> for Foo { +impl Display for Foo { } ", ); @@ -350,7 +350,7 @@ impl std::fmt::Display<|> for Foo { " use std::fmt::{Display, nested::Debug}; -impl Display<|> for Foo { +impl Display for Foo { } ", ); @@ -374,7 +374,7 @@ use crate::{ AssocItem, }; -fn foo() { lower<|>::trait_env() } +fn foo() { lower::trait_env() } ", ); } @@ -392,7 +392,7 @@ impl foo::Debug<|> for Foo { " use std::fmt as foo; -impl Debug<|> for Foo { +impl Debug for Foo { } ", ); @@ -435,7 +435,7 @@ mod foo { mod bar { use std::fmt::Debug; - Debug<|> + Debug } } ", @@ -458,7 +458,7 @@ fn main() { use std::fmt::Debug; fn main() { - Debug<|> + Debug } ", ); diff --git a/crates/ra_assists/src/tests.rs b/crates/ra_assists/src/tests.rs index 9ba3da786..373a7f7cc 100644 --- a/crates/ra_assists/src/tests.rs +++ b/crates/ra_assists/src/tests.rs @@ -105,18 +105,9 @@ fn check(handler: Handler, before: &str, expected: ExpectedResult) { change.edit.apply(&mut actual); if !source_change.is_snippet { - match source_change.cursor_position { - None => { - if let RangeOrOffset::Offset(before_cursor_pos) = range_or_offset { - let off = change - .edit - .apply_to_offset(before_cursor_pos) - .expect("cursor position is affected by the edit"); - actual = add_cursor(&actual, off) - } - } - Some(off) => actual = add_cursor(&actual, off.offset), - }; + if let Some(off) = source_change.cursor_position { + actual = add_cursor(&actual, off.offset) + } } assert_eq_text!(after, &actual); } -- cgit v1.2.3