Skip to content

Commit aa199ad

Browse files
committed
Pretty in macro for generate_delegate_methods
1 parent 067a08b commit aa199ad

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

crates/ide-assists/src/handlers/generate_delegate_methods.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use syntax::{
1010

1111
use crate::{
1212
AssistContext, AssistId, AssistKind, Assists, GroupLabel,
13-
utils::{convert_param_list_to_arg_list, find_struct_impl},
13+
utils::{convert_param_list_to_arg_list, find_struct_impl, pretty_node_inside_macro},
1414
};
1515

1616
// Assist: generate_delegate_methods
@@ -121,6 +121,8 @@ pub(crate) fn generate_delegate_methods(
121121
let source_scope = ctx.sema.scope(v.syntax());
122122
let target_scope = ctx.sema.scope(strukt.syntax());
123123
if let (Some(s), Some(t)) = (source_scope, target_scope) {
124+
let v =
125+
pretty_node_inside_macro(v, &ctx.sema, source.file_id, t.krate());
124126
ast::Fn::cast(
125127
PathTransform::generic_transformation(&t, &s).apply(v.syntax()),
126128
)
@@ -669,7 +671,7 @@ impl<'a, T> Bar<'a, T> {
669671
//- /bar.rs
670672
macro_rules! test_method {
671673
() => {
672-
pub fn test(self, b: Bar) -> Self {
674+
pub fn test(self, b: &mut Bar) -> Self {
673675
self
674676
}
675677
};
@@ -696,7 +698,7 @@ struct Foo {
696698
}
697699
698700
impl Foo {
699-
$0pub fn test(self,b:bar::Bar) ->bar::Bar {
701+
$0pub fn test(self,b: &mut bar::Bar) -> bar::Bar {
700702
self.bar.test(b)
701703
}
702704
}

0 commit comments

Comments
 (0)