@@ -22,7 +22,6 @@ use crate::{
22
22
// }
23
23
//
24
24
// impl Person {
25
- // /// Set the person's name.
26
25
// fn set_name(&mut self, name: String) {
27
26
// self.name = name;
28
27
// }
@@ -32,7 +31,6 @@ pub(crate) fn generate_setter(acc: &mut Assists, ctx: &AssistContext) -> Option<
32
31
let strukt = ctx. find_node_at_offset :: < ast:: Struct > ( ) ?;
33
32
let field = ctx. find_node_at_offset :: < ast:: RecordField > ( ) ?;
34
33
35
- let strukt_name = strukt. name ( ) ?;
36
34
let field_name = field. name ( ) ?;
37
35
let field_ty = field. ty ( ) ?;
38
36
@@ -53,23 +51,16 @@ pub(crate) fn generate_setter(acc: &mut Assists, ctx: &AssistContext) -> Option<
53
51
|builder| {
54
52
let mut buf = String :: with_capacity ( 512 ) ;
55
53
56
- let fn_name_spaced = fn_name. replace ( '_' , " " ) ;
57
- let strukt_name_spaced =
58
- to_lower_snake_case ( & strukt_name. to_string ( ) ) . replace ( '_' , " " ) ;
59
-
60
54
if impl_def. is_some ( ) {
61
55
buf. push ( '\n' ) ;
62
56
}
63
57
64
58
let vis = strukt. visibility ( ) . map_or ( String :: new ( ) , |v| format ! ( "{} " , v) ) ;
65
59
format_to ! (
66
60
buf,
67
- " /// Set the {}'s {}.
68
- {}fn set_{}(&mut self, {}: {}) {{
61
+ " {}fn set_{}(&mut self, {}: {}) {{
69
62
self.{} = {};
70
63
}}" ,
71
- strukt_name_spaced,
72
- fn_name_spaced,
73
64
vis,
74
65
fn_name,
75
66
fn_name,
@@ -114,7 +105,6 @@ struct Person<T: Clone> {
114
105
}
115
106
116
107
impl<T: Clone> Person<T> {
117
- /// Set the person's data.
118
108
fn set_data(&mut self, data: T) {
119
109
self.data = data;
120
110
}
@@ -152,7 +142,6 @@ pub(crate) struct Person<T: Clone> {
152
142
}
153
143
154
144
impl<T: Clone> Person<T> {
155
- /// Set the person's data.
156
145
pub(crate) fn set_data(&mut self, data: T) {
157
146
self.data = data;
158
147
}
@@ -171,7 +160,6 @@ struct Context<T: Clone> {
171
160
}
172
161
173
162
impl<T: Clone> Context<T> {
174
- /// Set the context's data.
175
163
fn set_data(&mut self, data: T) {
176
164
self.data = data;
177
165
}
@@ -183,12 +171,10 @@ struct Context<T: Clone> {
183
171
}
184
172
185
173
impl<T: Clone> Context<T> {
186
- /// Set the context's data.
187
174
fn set_data(&mut self, data: T) {
188
175
self.data = data;
189
176
}
190
177
191
- /// Set the context's count.
192
178
fn set_count(&mut self, count: usize) {
193
179
self.count = count;
194
180
}
0 commit comments