mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-14 08:57:34 +00:00
Don't generate documentation in generate_setter
This commit is contained in:
parent
da503b6a13
commit
54c8c39da0
2 changed files with 1 additions and 16 deletions
|
@ -22,7 +22,6 @@ use crate::{
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// impl Person {
|
// impl Person {
|
||||||
// /// Set the person's name.
|
|
||||||
// fn set_name(&mut self, name: String) {
|
// fn set_name(&mut self, name: String) {
|
||||||
// self.name = name;
|
// self.name = name;
|
||||||
// }
|
// }
|
||||||
|
@ -32,7 +31,6 @@ pub(crate) fn generate_setter(acc: &mut Assists, ctx: &AssistContext) -> Option<
|
||||||
let strukt = ctx.find_node_at_offset::<ast::Struct>()?;
|
let strukt = ctx.find_node_at_offset::<ast::Struct>()?;
|
||||||
let field = ctx.find_node_at_offset::<ast::RecordField>()?;
|
let field = ctx.find_node_at_offset::<ast::RecordField>()?;
|
||||||
|
|
||||||
let strukt_name = strukt.name()?;
|
|
||||||
let field_name = field.name()?;
|
let field_name = field.name()?;
|
||||||
let field_ty = field.ty()?;
|
let field_ty = field.ty()?;
|
||||||
|
|
||||||
|
@ -53,10 +51,6 @@ pub(crate) fn generate_setter(acc: &mut Assists, ctx: &AssistContext) -> Option<
|
||||||
|builder| {
|
|builder| {
|
||||||
let mut buf = String::with_capacity(512);
|
let mut buf = String::with_capacity(512);
|
||||||
|
|
||||||
let fn_name_spaced = fn_name.replace('_', " ");
|
|
||||||
let strukt_name_spaced =
|
|
||||||
to_lower_snake_case(&strukt_name.to_string()).replace('_', " ");
|
|
||||||
|
|
||||||
if impl_def.is_some() {
|
if impl_def.is_some() {
|
||||||
buf.push('\n');
|
buf.push('\n');
|
||||||
}
|
}
|
||||||
|
@ -64,12 +58,9 @@ pub(crate) fn generate_setter(acc: &mut Assists, ctx: &AssistContext) -> Option<
|
||||||
let vis = strukt.visibility().map_or(String::new(), |v| format!("{} ", v));
|
let vis = strukt.visibility().map_or(String::new(), |v| format!("{} ", v));
|
||||||
format_to!(
|
format_to!(
|
||||||
buf,
|
buf,
|
||||||
" /// Set the {}'s {}.
|
" {}fn set_{}(&mut self, {}: {}) {{
|
||||||
{}fn set_{}(&mut self, {}: {}) {{
|
|
||||||
self.{} = {};
|
self.{} = {};
|
||||||
}}",
|
}}",
|
||||||
strukt_name_spaced,
|
|
||||||
fn_name_spaced,
|
|
||||||
vis,
|
vis,
|
||||||
fn_name,
|
fn_name,
|
||||||
fn_name,
|
fn_name,
|
||||||
|
@ -114,7 +105,6 @@ struct Person<T: Clone> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: Clone> Person<T> {
|
impl<T: Clone> Person<T> {
|
||||||
/// Set the person's data.
|
|
||||||
fn set_data(&mut self, data: T) {
|
fn set_data(&mut self, data: T) {
|
||||||
self.data = data;
|
self.data = data;
|
||||||
}
|
}
|
||||||
|
@ -152,7 +142,6 @@ pub(crate) struct Person<T: Clone> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: Clone> Person<T> {
|
impl<T: Clone> Person<T> {
|
||||||
/// Set the person's data.
|
|
||||||
pub(crate) fn set_data(&mut self, data: T) {
|
pub(crate) fn set_data(&mut self, data: T) {
|
||||||
self.data = data;
|
self.data = data;
|
||||||
}
|
}
|
||||||
|
@ -171,7 +160,6 @@ struct Context<T: Clone> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: Clone> Context<T> {
|
impl<T: Clone> Context<T> {
|
||||||
/// Set the context's data.
|
|
||||||
fn set_data(&mut self, data: T) {
|
fn set_data(&mut self, data: T) {
|
||||||
self.data = data;
|
self.data = data;
|
||||||
}
|
}
|
||||||
|
@ -183,12 +171,10 @@ struct Context<T: Clone> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: Clone> Context<T> {
|
impl<T: Clone> Context<T> {
|
||||||
/// Set the context's data.
|
|
||||||
fn set_data(&mut self, data: T) {
|
fn set_data(&mut self, data: T) {
|
||||||
self.data = data;
|
self.data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Set the context's count.
|
|
||||||
fn set_count(&mut self, count: usize) {
|
fn set_count(&mut self, count: usize) {
|
||||||
self.count = count;
|
self.count = count;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1158,7 +1158,6 @@ struct Person {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Person {
|
impl Person {
|
||||||
/// Set the person's name.
|
|
||||||
fn set_name(&mut self, name: String) {
|
fn set_name(&mut self, name: String) {
|
||||||
self.name = name;
|
self.name = name;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue