mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 04:53:34 +00:00
enum variant wording
This commit is contained in:
parent
ee84622c92
commit
93a8fcf7a8
3 changed files with 9 additions and 9 deletions
|
@ -10,7 +10,7 @@ use crate::{
|
||||||
|
|
||||||
// Assist: generate_enum_is_method
|
// Assist: generate_enum_is_method
|
||||||
//
|
//
|
||||||
// Generate an `is_` method for an enum variant.
|
// Generate an `is_` method for this enum variant.
|
||||||
//
|
//
|
||||||
// ```
|
// ```
|
||||||
// enum Version {
|
// enum Version {
|
||||||
|
@ -56,9 +56,9 @@ pub(crate) fn generate_enum_is_method(acc: &mut Assists, ctx: &AssistContext) ->
|
||||||
|
|
||||||
let target = variant.syntax().text_range();
|
let target = variant.syntax().text_range();
|
||||||
acc.add_group(
|
acc.add_group(
|
||||||
&GroupLabel("Generate `is_`,`as_`,`try_into_`".to_owned()),
|
&GroupLabel("Generate an `is_`,`as_`, or `try_into_` for this enum variant".to_owned()),
|
||||||
AssistId("generate_enum_is_method", AssistKind::Generate),
|
AssistId("generate_enum_is_method", AssistKind::Generate),
|
||||||
"Generate an `is_` method for an enum variant",
|
"Generate an `is_` method for this enum variant",
|
||||||
target,
|
target,
|
||||||
|builder| {
|
|builder| {
|
||||||
let vis = parent_enum.visibility().map_or(String::new(), |v| format!("{} ", v));
|
let vis = parent_enum.visibility().map_or(String::new(), |v| format!("{} ", v));
|
||||||
|
|
|
@ -11,7 +11,7 @@ use crate::{
|
||||||
|
|
||||||
// Assist: generate_enum_try_into_method
|
// Assist: generate_enum_try_into_method
|
||||||
//
|
//
|
||||||
// Generate an `try_into_` method for an enum variant.
|
// Generate a `try_into_` method for this enum variant.
|
||||||
//
|
//
|
||||||
// ```
|
// ```
|
||||||
// enum Value {
|
// enum Value {
|
||||||
|
@ -41,7 +41,7 @@ pub(crate) fn generate_enum_try_into_method(acc: &mut Assists, ctx: &AssistConte
|
||||||
acc,
|
acc,
|
||||||
ctx,
|
ctx,
|
||||||
"generate_enum_try_into_method",
|
"generate_enum_try_into_method",
|
||||||
"Generate an `try_into_` method for an enum variant",
|
"Generate a `try_into_` method for this enum variant",
|
||||||
ProjectionProps {
|
ProjectionProps {
|
||||||
fn_name_prefix: "try_into",
|
fn_name_prefix: "try_into",
|
||||||
self_param: "self",
|
self_param: "self",
|
||||||
|
@ -55,7 +55,7 @@ pub(crate) fn generate_enum_try_into_method(acc: &mut Assists, ctx: &AssistConte
|
||||||
|
|
||||||
// Assist: generate_enum_as_method
|
// Assist: generate_enum_as_method
|
||||||
//
|
//
|
||||||
// Generate an `as_` method for an enum variant.
|
// Generate an `as_` method for this enum variant.
|
||||||
//
|
//
|
||||||
// ```
|
// ```
|
||||||
// enum Value {
|
// enum Value {
|
||||||
|
@ -85,7 +85,7 @@ pub(crate) fn generate_enum_as_method(acc: &mut Assists, ctx: &AssistContext) ->
|
||||||
acc,
|
acc,
|
||||||
ctx,
|
ctx,
|
||||||
"generate_enum_as_method",
|
"generate_enum_as_method",
|
||||||
"Generate an `as_` method for an enum variant",
|
"Generate an `as_` method for this enum variant",
|
||||||
ProjectionProps {
|
ProjectionProps {
|
||||||
fn_name_prefix: "as",
|
fn_name_prefix: "as",
|
||||||
self_param: "&self",
|
self_param: "&self",
|
||||||
|
@ -141,7 +141,7 @@ fn generate_enum_projection_method(
|
||||||
|
|
||||||
let target = variant.syntax().text_range();
|
let target = variant.syntax().text_range();
|
||||||
acc.add_group(
|
acc.add_group(
|
||||||
&GroupLabel("Generate `is_`,`as_`,`try_into_`".to_owned()),
|
&GroupLabel("Generate an `is_`,`as_`, or `try_into_` for this enum variant".to_owned()),
|
||||||
AssistId(assist_id, AssistKind::Generate),
|
AssistId(assist_id, AssistKind::Generate),
|
||||||
assist_description,
|
assist_description,
|
||||||
target,
|
target,
|
||||||
|
|
|
@ -5,7 +5,7 @@ use crate::{utils::generate_trait_impl_text, AssistContext, AssistId, AssistKind
|
||||||
|
|
||||||
// Assist: generate_from_impl_for_enum
|
// Assist: generate_from_impl_for_enum
|
||||||
//
|
//
|
||||||
// Adds a From impl for an enum variant with one tuple field.
|
// Adds a From impl for this enum variant with one tuple field.
|
||||||
//
|
//
|
||||||
// ```
|
// ```
|
||||||
// enum A { $0One(u32) }
|
// enum A { $0One(u32) }
|
||||||
|
|
Loading…
Reference in a new issue