Skip to content

Commit 6c24144

Browse files
committed
use GroupLabel for type safety
1 parent d5b9282 commit 6c24144

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

crates/ra_assists/src/assist_ctx.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ impl<'a> AssistCtx<'a> {
116116
}
117117

118118
pub(crate) fn add_assist_group(self, group_name: impl Into<String>) -> AssistGroup<'a> {
119-
AssistGroup { ctx: self, group: group_name.into(), assists: Vec::new() }
119+
let group = GroupLabel(group_name.into());
120+
AssistGroup { ctx: self, group, assists: Vec::new() }
120121
}
121122

122123
pub(crate) fn token_at_offset(&self) -> TokenAtOffset<SyntaxToken> {
@@ -146,7 +147,7 @@ impl<'a> AssistCtx<'a> {
146147

147148
pub(crate) struct AssistGroup<'a> {
148149
ctx: AssistCtx<'a>,
149-
group: String,
150+
group: GroupLabel,
150151
assists: Vec<AssistInfo>,
151152
}
152153

@@ -159,7 +160,7 @@ impl<'a> AssistGroup<'a> {
159160
) {
160161
let label = AssistLabel::new(id, label.into());
161162

162-
let mut info = AssistInfo::new(label).with_group(GroupLabel(self.group.clone()));
163+
let mut info = AssistInfo::new(label).with_group(self.group.clone());
163164
if self.ctx.should_compute_edit {
164165
let action = {
165166
let mut edit = ActionBuilder::new(&self.ctx);

0 commit comments

Comments
 (0)