File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed
crates/ide/src/completion Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -225,7 +225,7 @@ impl Completions {
225
225
. flat_map ( |( it, param_ty) | {
226
226
if let Some ( pat) = it. pat ( ) {
227
227
let name = pat. to_string ( ) ;
228
- let arg = name. trim_start_matches ( '_' ) ;
228
+ let arg = name. trim_start_matches ( "mut " ) . trim_start_matches ( '_' ) ;
229
229
return Some ( add_arg ( arg, param_ty. ty ( ) , ctx) ) ;
230
230
}
231
231
None
@@ -961,6 +961,27 @@ fn main() {
961
961
) ;
962
962
}
963
963
964
+ #[ test]
965
+ fn trim_mut_keyword_in_func_completion ( ) {
966
+ check_edit (
967
+ "take_mutably" ,
968
+ r#"
969
+ fn take_mutably(mut x: &i32) {}
970
+
971
+ fn main() {
972
+ take_m<|>
973
+ }
974
+ "# ,
975
+ r#"
976
+ fn take_mutably(mut x: &i32) {}
977
+
978
+ fn main() {
979
+ take_mutably(${1:x})$0
980
+ }
981
+ "# ,
982
+ ) ;
983
+ }
984
+
964
985
#[ test]
965
986
fn inserts_parens_for_tuple_enums ( ) {
966
987
mark:: check!( inserts_parens_for_tuple_enums) ;
You can’t perform that action at this time.
0 commit comments