@@ -5,7 +5,7 @@ use syntax::{
55
66use crate :: { AssistContext , AssistId , AssistKind , Assists } ;
77
8- // Assist: convert_ufcs_to_method
8+ // Assist: unqualify_method_call
99//
1010// Transforms universal function call syntax into a method call.
1111//
@@ -22,7 +22,7 @@ use crate::{AssistContext, AssistId, AssistKind, Assists};
2222// }
2323// # mod std { pub mod ops { pub trait Add { fn add(self, _: Self) {} } impl Add for i32 {} } }
2424// ```
25- pub ( crate ) fn convert_ufcs_to_method ( acc : & mut Assists , ctx : & AssistContext < ' _ > ) -> Option < ( ) > {
25+ pub ( crate ) fn unqualify_method_call ( acc : & mut Assists , ctx : & AssistContext < ' _ > ) -> Option < ( ) > {
2626 let call = ctx. find_node_at_offset :: < ast:: CallExpr > ( ) ?;
2727 let ast:: Expr :: PathExpr ( path_expr) = call. expr ( ) ? else { return None } ;
2828 let path = path_expr. path ( ) ?;
@@ -66,8 +66,8 @@ pub(crate) fn convert_ufcs_to_method(acc: &mut Assists, ctx: &AssistContext<'_>)
6666 ) ;
6767
6868 acc. add (
69- AssistId ( "convert_ufcs_to_method " , AssistKind :: RefactorRewrite ) ,
70- "Convert UFCS to a method call" ,
69+ AssistId ( "unqualify_method_call " , AssistKind :: RefactorRewrite ) ,
70+ "Unqualify method call" ,
7171 call. syntax ( ) . text_range ( ) ,
7272 |edit| {
7373 edit. delete ( delete_path) ;
@@ -105,9 +105,9 @@ mod tests {
105105 use super :: * ;
106106
107107 #[ test]
108- fn ufcs2method_simple ( ) {
108+ fn unqualify_method_call_simple ( ) {
109109 check_assist (
110- convert_ufcs_to_method ,
110+ unqualify_method_call ,
111111 r#"
112112struct S;
113113impl S { fn f(self, S: S) {} }
@@ -120,9 +120,9 @@ fn f() { S.f(S); }"#,
120120 }
121121
122122 #[ test]
123- fn ufcs2method_trait ( ) {
123+ fn unqualify_method_call_trait ( ) {
124124 check_assist (
125- convert_ufcs_to_method ,
125+ unqualify_method_call ,
126126 r#"
127127//- minicore: add
128128fn f() { <u32 as core::ops::Add>::$0add(2, 2); }"# ,
@@ -131,7 +131,7 @@ fn f() { 2.add(2); }"#,
131131 ) ;
132132
133133 check_assist (
134- convert_ufcs_to_method ,
134+ unqualify_method_call ,
135135 r#"
136136//- minicore: add
137137fn f() { core::ops::Add::$0add(2, 2); }"# ,
@@ -140,7 +140,7 @@ fn f() { 2.add(2); }"#,
140140 ) ;
141141
142142 check_assist (
143- convert_ufcs_to_method ,
143+ unqualify_method_call ,
144144 r#"
145145//- minicore: add
146146use core::ops::Add;
@@ -152,9 +152,9 @@ fn f() { 2.add(2); }"#,
152152 }
153153
154154 #[ test]
155- fn ufcs2method_single_arg ( ) {
155+ fn unqualify_method_call_single_arg ( ) {
156156 check_assist (
157- convert_ufcs_to_method ,
157+ unqualify_method_call ,
158158 r#"
159159 struct S;
160160 impl S { fn f(self) {} }
@@ -167,9 +167,9 @@ fn f() { 2.add(2); }"#,
167167 }
168168
169169 #[ test]
170- fn ufcs2method_parens ( ) {
170+ fn unqualify_method_call_parens ( ) {
171171 check_assist (
172- convert_ufcs_to_method ,
172+ unqualify_method_call ,
173173 r#"
174174//- minicore: deref
175175struct S;
@@ -189,19 +189,19 @@ fn f() { (&S).deref(); }"#,
189189 }
190190
191191 #[ test]
192- fn ufcs2method_doesnt_apply_with_cursor_not_on_path ( ) {
192+ fn unqualify_method_call_doesnt_apply_with_cursor_not_on_path ( ) {
193193 check_assist_not_applicable (
194- convert_ufcs_to_method ,
194+ unqualify_method_call ,
195195 r#"
196196//- minicore: add
197197fn f() { core::ops::Add::add(2,$0 2); }"# ,
198198 ) ;
199199 }
200200
201201 #[ test]
202- fn ufcs2method_doesnt_apply_with_no_self ( ) {
202+ fn unqualify_method_call_doesnt_apply_with_no_self ( ) {
203203 check_assist_not_applicable (
204- convert_ufcs_to_method ,
204+ unqualify_method_call ,
205205 r#"
206206struct S;
207207impl S { fn assoc(S: S, S: S) {} }
0 commit comments