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 {
225225 . flat_map ( |( it, param_ty) | {
226226 if let Some ( pat) = it. pat ( ) {
227227 let name = pat. to_string ( ) ;
228- let arg = name. trim_start_matches ( '_' ) ;
228+ let arg = name. trim_start_matches ( "mut " ) . trim_start_matches ( '_' ) ;
229229 return Some ( add_arg ( arg, param_ty. ty ( ) , ctx) ) ;
230230 }
231231 None
@@ -961,6 +961,27 @@ fn main() {
961961 ) ;
962962 }
963963
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+
964985 #[ test]
965986 fn inserts_parens_for_tuple_enums ( ) {
966987 mark:: check!( inserts_parens_for_tuple_enums) ;
You can’t perform that action at this time.
0 commit comments