From f67586066d5299c11ee69823a6dfd3148eaa5ec7 Mon Sep 17 00:00:00 2001 From: Domantas Jadenkus Date: Sun, 14 Feb 2021 11:09:56 +0200 Subject: [PATCH] rename existing assist to generate_enum_is_method --- .../src/handlers/generate_enum_match_method.rs | 16 ++++++++-------- crates/ide_assists/src/lib.rs | 2 +- crates/ide_assists/src/tests/generated.rs | 4 ++-- 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 aeb887e717c..3a7177dbf1b 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::{ AssistContext, AssistId, AssistKind, Assists, }; -// Assist: generate_enum_match_method +// Assist: generate_enum_is_method // // Generate an `is_` method for an enum variant. // @@ -34,7 +34,7 @@ use crate::{ // } // } // ``` -pub(crate) fn generate_enum_match_method(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { +pub(crate) fn generate_enum_is_method(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { let variant = ctx.find_node_at_offset::()?; let variant_name = variant.name()?; let parent_enum = variant.parent_enum(); @@ -55,7 +55,7 @@ pub(crate) fn generate_enum_match_method(acc: &mut Assists, ctx: &AssistContext) let target = variant.syntax().text_range(); acc.add( - AssistId("generate_enum_match_method", AssistKind::Generate), + AssistId("generate_enum_is_method", AssistKind::Generate), "Generate an `is_` method for an enum variant", target, |builder| { @@ -100,13 +100,13 @@ mod tests { use super::*; fn check_not_applicable(ra_fixture: &str) { - check_assist_not_applicable(generate_enum_match_method, ra_fixture) + check_assist_not_applicable(generate_enum_is_method, ra_fixture) } #[test] fn test_generate_enum_match_from_variant() { check_assist( - generate_enum_match_method, + generate_enum_is_method, r#" enum Variant { Undefined, @@ -162,7 +162,7 @@ enum Variant { #[test] fn test_generate_enum_match_from_variant_with_one_variant() { check_assist( - generate_enum_match_method, + generate_enum_is_method, r#"enum Variant { Undefi$0ned }"#, r#" enum Variant { Undefined } @@ -179,7 +179,7 @@ impl Variant { #[test] fn test_generate_enum_match_from_variant_with_visibility_marker() { check_assist( - generate_enum_match_method, + generate_enum_is_method, r#" pub(crate) enum Variant { Undefined, @@ -204,7 +204,7 @@ impl Variant { #[test] fn test_multiple_generate_enum_match_from_variant() { check_assist( - generate_enum_match_method, + generate_enum_is_method, r#" enum Variant { Undefined, diff --git a/crates/ide_assists/src/lib.rs b/crates/ide_assists/src/lib.rs index f4c7e6fbf7c..601199cd08e 100644 --- a/crates/ide_assists/src/lib.rs +++ b/crates/ide_assists/src/lib.rs @@ -189,7 +189,7 @@ mod handlers { flip_trait_bound::flip_trait_bound, generate_default_from_enum_variant::generate_default_from_enum_variant, generate_derive::generate_derive, - generate_enum_match_method::generate_enum_match_method, + generate_enum_match_method::generate_enum_is_method, generate_from_impl_for_enum::generate_from_impl_for_enum, generate_function::generate_function, generate_getter::generate_getter, diff --git a/crates/ide_assists/src/tests/generated.rs b/crates/ide_assists/src/tests/generated.rs index d4287582226..44bede0d98e 100644 --- a/crates/ide_assists/src/tests/generated.rs +++ b/crates/ide_assists/src/tests/generated.rs @@ -483,9 +483,9 @@ struct Point { } #[test] -fn doctest_generate_enum_match_method() { +fn doctest_generate_enum_is_method() { check_doc_test( - "generate_enum_match_method", + "generate_enum_is_method", r#####" enum Version { Undefined,