@@ -22,7 +22,6 @@ use crate::{
2222// }
2323//
2424// impl Person {
25- // /// Set the person's name.
2625// fn set_name(&mut self, name: String) {
2726// self.name = name;
2827// }
@@ -32,7 +31,6 @@ pub(crate) fn generate_setter(acc: &mut Assists, ctx: &AssistContext) -> Option<
3231 let strukt = ctx. find_node_at_offset :: < ast:: Struct > ( ) ?;
3332 let field = ctx. find_node_at_offset :: < ast:: RecordField > ( ) ?;
3433
35- let strukt_name = strukt. name ( ) ?;
3634 let field_name = field. name ( ) ?;
3735 let field_ty = field. ty ( ) ?;
3836
@@ -53,23 +51,16 @@ pub(crate) fn generate_setter(acc: &mut Assists, ctx: &AssistContext) -> Option<
5351 |builder| {
5452 let mut buf = String :: with_capacity ( 512 ) ;
5553
56- let fn_name_spaced = fn_name. replace ( '_' , " " ) ;
57- let strukt_name_spaced =
58- to_lower_snake_case ( & strukt_name. to_string ( ) ) . replace ( '_' , " " ) ;
59-
6054 if impl_def. is_some ( ) {
6155 buf. push ( '\n' ) ;
6256 }
6357
6458 let vis = strukt. visibility ( ) . map_or ( String :: new ( ) , |v| format ! ( "{} " , v) ) ;
6559 format_to ! (
6660 buf,
67- " /// Set the {}'s {}.
68- {}fn set_{}(&mut self, {}: {}) {{
61+ " {}fn set_{}(&mut self, {}: {}) {{
6962 self.{} = {};
7063 }}" ,
71- strukt_name_spaced,
72- fn_name_spaced,
7364 vis,
7465 fn_name,
7566 fn_name,
@@ -114,7 +105,6 @@ struct Person<T: Clone> {
114105}
115106
116107impl<T: Clone> Person<T> {
117- /// Set the person's data.
118108 fn set_data(&mut self, data: T) {
119109 self.data = data;
120110 }
@@ -152,7 +142,6 @@ pub(crate) struct Person<T: Clone> {
152142}
153143
154144impl<T: Clone> Person<T> {
155- /// Set the person's data.
156145 pub(crate) fn set_data(&mut self, data: T) {
157146 self.data = data;
158147 }
@@ -171,7 +160,6 @@ struct Context<T: Clone> {
171160}
172161
173162impl<T: Clone> Context<T> {
174- /// Set the context's data.
175163 fn set_data(&mut self, data: T) {
176164 self.data = data;
177165 }
@@ -183,12 +171,10 @@ struct Context<T: Clone> {
183171}
184172
185173impl<T: Clone> Context<T> {
186- /// Set the context's data.
187174 fn set_data(&mut self, data: T) {
188175 self.data = data;
189176 }
190177
191- /// Set the context's count.
192178 fn set_count(&mut self, count: usize) {
193179 self.count = count;
194180 }
0 commit comments