aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_assists/src/handlers
diff options
context:
space:
mode:
authorDomantas Jadenkus <[email protected]>2021-02-14 09:09:56 +0000
committerDomantas Jadenkus <[email protected]>2021-02-27 10:05:59 +0000
commitf67586066d5299c11ee69823a6dfd3148eaa5ec7 (patch)
tree2cbd4b5d6e9d28d95eb2b1b66708a712031040ef /crates/ide_assists/src/handlers
parent2a4076c14d0e3f7ae03908c2b9cd1a52851d401c (diff)
rename existing assist to generate_enum_is_method
Diffstat (limited to 'crates/ide_assists/src/handlers')
-rw-r--r--crates/ide_assists/src/handlers/generate_enum_match_method.rs16
1 files changed, 8 insertions, 8 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,