From 6c2414430aca92f95eda9f0238dce8af2de552af Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 5 May 2020 20:34:45 +0200 Subject: use GroupLabel for type safety --- crates/ra_assists/src/assist_ctx.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'crates') diff --git a/crates/ra_assists/src/assist_ctx.rs b/crates/ra_assists/src/assist_ctx.rs index 1020fed29..d88ae4413 100644 --- a/crates/ra_assists/src/assist_ctx.rs +++ b/crates/ra_assists/src/assist_ctx.rs @@ -116,7 +116,8 @@ impl<'a> AssistCtx<'a> { } pub(crate) fn add_assist_group(self, group_name: impl Into) -> AssistGroup<'a> { - AssistGroup { ctx: self, group: group_name.into(), assists: Vec::new() } + let group = GroupLabel(group_name.into()); + AssistGroup { ctx: self, group, assists: Vec::new() } } pub(crate) fn token_at_offset(&self) -> TokenAtOffset { @@ -146,7 +147,7 @@ impl<'a> AssistCtx<'a> { pub(crate) struct AssistGroup<'a> { ctx: AssistCtx<'a>, - group: String, + group: GroupLabel, assists: Vec, } @@ -159,7 +160,7 @@ impl<'a> AssistGroup<'a> { ) { let label = AssistLabel::new(id, label.into()); - let mut info = AssistInfo::new(label).with_group(GroupLabel(self.group.clone())); + let mut info = AssistInfo::new(label).with_group(self.group.clone()); if self.ctx.should_compute_edit { let action = { let mut edit = ActionBuilder::new(&self.ctx); -- cgit v1.2.3