aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_assists
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-05-05 19:34:45 +0100
committerAleksey Kladov <[email protected]>2020-05-05 19:34:45 +0100
commit6c2414430aca92f95eda9f0238dce8af2de552af (patch)
treeb25090ce6ba05503c2d654f78ced191971225124 /crates/ra_assists
parentd5b9282ede9947e5743608054e09222033a4e6e4 (diff)
use GroupLabel for type safety
Diffstat (limited to 'crates/ra_assists')
-rw-r--r--crates/ra_assists/src/assist_ctx.rs7
1 files changed, 4 insertions, 3 deletions
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> {
116 } 116 }
117 117
118 pub(crate) fn add_assist_group(self, group_name: impl Into<String>) -> AssistGroup<'a> { 118 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() }
120 } 121 }
121 122
122 pub(crate) fn token_at_offset(&self) -> TokenAtOffset<SyntaxToken> { 123 pub(crate) fn token_at_offset(&self) -> TokenAtOffset<SyntaxToken> {
@@ -146,7 +147,7 @@ impl<'a> AssistCtx<'a> {
146 147
147pub(crate) struct AssistGroup<'a> { 148pub(crate) struct AssistGroup<'a> {
148 ctx: AssistCtx<'a>, 149 ctx: AssistCtx<'a>,
149 group: String, 150 group: GroupLabel,
150 assists: Vec<AssistInfo>, 151 assists: Vec<AssistInfo>,
151} 152}
152 153
@@ -159,7 +160,7 @@ impl<'a> AssistGroup<'a> {
159 ) { 160 ) {
160 let label = AssistLabel::new(id, label.into()); 161 let label = AssistLabel::new(id, label.into());
161 162
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());
163 if self.ctx.should_compute_edit { 164 if self.ctx.should_compute_edit {
164 let action = { 165 let action = {
165 let mut edit = ActionBuilder::new(&self.ctx); 166 let mut edit = ActionBuilder::new(&self.ctx);