File tree Expand file tree Collapse file tree 1 file changed +29
-1
lines changed
src/tools/rust-analyzer/crates/ide-assists/src/handlers Expand file tree Collapse file tree 1 file changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -316,7 +316,7 @@ impl FunctionBuilder {
316316 let current_module = ctx. sema . scope ( call. syntax ( ) ) ?. module ( ) ;
317317 let visibility = calculate_necessary_visibility ( current_module, target_module, ctx) ;
318318
319- let fn_name = make:: name ( & name. text ( ) ) ;
319+ let fn_name = make:: name ( name. ident_token ( ) ? . text ( ) ) ;
320320 let mut necessary_generic_params = FxHashSet :: default ( ) ;
321321 necessary_generic_params. extend ( receiver_ty. generic_params ( ctx. db ( ) ) ) ;
322322 let params = fn_args (
@@ -3131,4 +3131,32 @@ fn main() {
31313131 "# ,
31323132 )
31333133 }
3134+
3135+ #[ test]
3136+ fn no_generate_method_by_keyword ( ) {
3137+ check_assist_not_applicable (
3138+ generate_function,
3139+ r#"
3140+ fn main() {
3141+ s.super$0();
3142+ }
3143+ "# ,
3144+ ) ;
3145+ check_assist_not_applicable (
3146+ generate_function,
3147+ r#"
3148+ fn main() {
3149+ s.Self$0();
3150+ }
3151+ "# ,
3152+ ) ;
3153+ check_assist_not_applicable (
3154+ generate_function,
3155+ r#"
3156+ fn main() {
3157+ s.self$0();
3158+ }
3159+ "# ,
3160+ ) ;
3161+ }
31343162}
You can’t perform that action at this time.
0 commit comments