aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ide_assists/src/handlers/generate_enum_match_method.rs16
-rw-r--r--crates/ide_assists/src/lib.rs2
-rw-r--r--crates/ide_assists/src/tests/generated.rs4
3 files changed, 11 insertions, 11 deletions
diff --git a/crates/ide_assists/src/handlers/generate_enum_match_method.rs b/crates/ide_assists/src/handlers/generate_enum_match_method.rs
index aeb887e71..3a7177dbf 100644
--- a/crates/ide_assists/src/handlers/generate_enum_match_method.rs
+++ b/crates/ide_assists/src/handlers/generate_enum_match_method.rs
@@ -8,7 +8,7 @@ use crate::{
8 AssistContext, AssistId, AssistKind, Assists, 8 AssistContext, AssistId, AssistKind, Assists,
9}; 9};
10 10
11// Assist: generate_enum_match_method 11// Assist: generate_enum_is_method
12// 12//
13// Generate an `is_` method for an enum variant. 13// Generate an `is_` method for an enum variant.
14// 14//
@@ -34,7 +34,7 @@ use crate::{
34// } 34// }
35// } 35// }
36// ``` 36// ```
37pub(crate) fn generate_enum_match_method(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { 37pub(crate) fn generate_enum_is_method(acc: &mut Assists, ctx: &AssistContext) -> Option<()> {
38 let variant = ctx.find_node_at_offset::<ast::Variant>()?; 38 let variant = ctx.find_node_at_offset::<ast::Variant>()?;
39 let variant_name = variant.name()?; 39 let variant_name = variant.name()?;
40 let parent_enum = variant.parent_enum(); 40 let parent_enum = variant.parent_enum();
@@ -55,7 +55,7 @@ pub(crate) fn generate_enum_match_method(acc: &mut Assists, ctx: &AssistContext)
55 55
56 let target = variant.syntax().text_range(); 56 let target = variant.syntax().text_range();
57 acc.add( 57 acc.add(
58 AssistId("generate_enum_match_method", AssistKind::Generate), 58 AssistId("generate_enum_is_method", AssistKind::Generate),
59 "Generate an `is_` method for an enum variant", 59 "Generate an `is_` method for an enum variant",
60 target, 60 target,
61 |builder| { 61 |builder| {
@@ -100,13 +100,13 @@ mod tests {
100 use super::*; 100 use super::*;
101 101
102 fn check_not_applicable(ra_fixture: &str) { 102 fn check_not_applicable(ra_fixture: &str) {
103 check_assist_not_applicable(generate_enum_match_method, ra_fixture) 103 check_assist_not_applicable(generate_enum_is_method, ra_fixture)
104 } 104 }
105 105
106 #[test] 106 #[test]
107 fn test_generate_enum_match_from_variant() { 107 fn test_generate_enum_match_from_variant() {
108 check_assist( 108 check_assist(
109 generate_enum_match_method, 109 generate_enum_is_method,
110 r#" 110 r#"
111enum Variant { 111enum Variant {
112 Undefined, 112 Undefined,
@@ -162,7 +162,7 @@ enum Variant {
162 #[test] 162 #[test]
163 fn test_generate_enum_match_from_variant_with_one_variant() { 163 fn test_generate_enum_match_from_variant_with_one_variant() {
164 check_assist( 164 check_assist(
165 generate_enum_match_method, 165 generate_enum_is_method,
166 r#"enum Variant { Undefi$0ned }"#, 166 r#"enum Variant { Undefi$0ned }"#,
167 r#" 167 r#"
168enum Variant { Undefined } 168enum Variant { Undefined }
@@ -179,7 +179,7 @@ impl Variant {
179 #[test] 179 #[test]
180 fn test_generate_enum_match_from_variant_with_visibility_marker() { 180 fn test_generate_enum_match_from_variant_with_visibility_marker() {
181 check_assist( 181 check_assist(
182 generate_enum_match_method, 182 generate_enum_is_method,
183 r#" 183 r#"
184pub(crate) enum Variant { 184pub(crate) enum Variant {
185 Undefined, 185 Undefined,
@@ -204,7 +204,7 @@ impl Variant {
204 #[test] 204 #[test]
205 fn test_multiple_generate_enum_match_from_variant() { 205 fn test_multiple_generate_enum_match_from_variant() {
206 check_assist( 206 check_assist(
207 generate_enum_match_method, 207 generate_enum_is_method,
208 r#" 208 r#"
209enum Variant { 209enum Variant {
210 Undefined, 210 Undefined,
diff --git a/crates/ide_assists/src/lib.rs b/crates/ide_assists/src/lib.rs
index f4c7e6fbf..601199cd0 100644
--- a/crates/ide_assists/src/lib.rs
+++ b/crates/ide_assists/src/lib.rs
@@ -189,7 +189,7 @@ mod handlers {
189 flip_trait_bound::flip_trait_bound, 189 flip_trait_bound::flip_trait_bound,
190 generate_default_from_enum_variant::generate_default_from_enum_variant, 190 generate_default_from_enum_variant::generate_default_from_enum_variant,
191 generate_derive::generate_derive, 191 generate_derive::generate_derive,
192 generate_enum_match_method::generate_enum_match_method, 192 generate_enum_match_method::generate_enum_is_method,
193 generate_from_impl_for_enum::generate_from_impl_for_enum, 193 generate_from_impl_for_enum::generate_from_impl_for_enum,
194 generate_function::generate_function, 194 generate_function::generate_function,
195 generate_getter::generate_getter, 195 generate_getter::generate_getter,
diff --git a/crates/ide_assists/src/tests/generated.rs b/crates/ide_assists/src/tests/generated.rs
index d42875822..44bede0d9 100644
--- a/crates/ide_assists/src/tests/generated.rs
+++ b/crates/ide_assists/src/tests/generated.rs
@@ -483,9 +483,9 @@ struct Point {
483} 483}
484 484
485#[test] 485#[test]
486fn doctest_generate_enum_match_method() { 486fn doctest_generate_enum_is_method() {
487 check_doc_test( 487 check_doc_test(
488 "generate_enum_match_method", 488 "generate_enum_is_method",
489 r#####" 489 r#####"
490enum Version { 490enum Version {
491 Undefined, 491 Undefined,