1
1
use ra_ide_db:: RootDatabase ;
2
- use ra_syntax:: {
3
- ast:: { self , AstNode , NameOwner } ,
4
- TextSize ,
5
- } ;
2
+ use ra_syntax:: ast:: { self , AstNode , NameOwner } ;
6
3
use stdx:: format_to;
7
4
use test_utils:: tested_by;
8
5
@@ -69,7 +66,6 @@ impl From<{0}> for {1} {{
69
66
variant_name
70
67
) ;
71
68
edit. insert ( start_offset, buf) ;
72
- edit. set_cursor ( start_offset + TextSize :: of ( "\n \n " ) ) ;
73
69
} ,
74
70
)
75
71
}
@@ -97,19 +93,20 @@ fn existing_from_impl(
97
93
98
94
#[ cfg( test) ]
99
95
mod tests {
100
- use super :: * ;
96
+ use test_utils :: covers ;
101
97
102
98
use crate :: tests:: { check_assist, check_assist_not_applicable} ;
103
- use test_utils:: covers;
99
+
100
+ use super :: * ;
104
101
105
102
#[ test]
106
103
fn test_add_from_impl_for_enum ( ) {
107
104
check_assist (
108
105
add_from_impl_for_enum,
109
106
"enum A { <|>One(u32) }" ,
110
- r#"enum A { One(u32) }
107
+ r#"enum A { <|> One(u32) }
111
108
112
- <|> impl From<u32> for A {
109
+ impl From<u32> for A {
113
110
fn from(v: u32) -> Self {
114
111
A::One(v)
115
112
}
@@ -121,10 +118,10 @@ mod tests {
121
118
fn test_add_from_impl_for_enum_complicated_path ( ) {
122
119
check_assist (
123
120
add_from_impl_for_enum,
124
- "enum A { <|>One(foo::bar::baz::Boo) }" ,
125
- r#"enum A { One(foo::bar::baz::Boo) }
121
+ r# "enum A { <|>One(foo::bar::baz::Boo) }"# ,
122
+ r#"enum A { <|> One(foo::bar::baz::Boo) }
126
123
127
- <|> impl From<foo::bar::baz::Boo> for A {
124
+ impl From<foo::bar::baz::Boo> for A {
128
125
fn from(v: foo::bar::baz::Boo) -> Self {
129
126
A::One(v)
130
127
}
@@ -184,9 +181,9 @@ impl From<String> for A {
184
181
pub trait From<T> {
185
182
fn from(T) -> Self;
186
183
}"# ,
187
- r#"enum A { One(u32), Two(String), }
184
+ r#"enum A { <|> One(u32), Two(String), }
188
185
189
- <|> impl From<u32> for A {
186
+ impl From<u32> for A {
190
187
fn from(v: u32) -> Self {
191
188
A::One(v)
192
189
}
0 commit comments