Skip to content

Commit aee22c7

Browse files
committed
Move group_label where it belongs
1 parent 6c24144 commit aee22c7

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

crates/ra_assists/src/assist_ctx.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ impl AssistInfo {
3838

3939
pub(crate) fn into_resolved(self) -> Option<ResolvedAssist> {
4040
let label = self.label;
41-
let group_label = self.group_label;
42-
self.action.map(|action| ResolvedAssist { label, group_label, action })
41+
self.action.map(|action| ResolvedAssist { label, action })
4342
}
4443
}
4544

@@ -100,7 +99,7 @@ impl<'a> AssistCtx<'a> {
10099
label: impl Into<String>,
101100
f: impl FnOnce(&mut ActionBuilder),
102101
) -> Option<Assist> {
103-
let label = AssistLabel::new(id, label.into());
102+
let label = AssistLabel::new(id, label.into(), None);
104103

105104
let mut info = AssistInfo::new(label);
106105
if self.should_compute_edit {
@@ -158,7 +157,7 @@ impl<'a> AssistGroup<'a> {
158157
label: impl Into<String>,
159158
f: impl FnOnce(&mut ActionBuilder),
160159
) {
161-
let label = AssistLabel::new(id, label.into());
160+
let label = AssistLabel::new(id, label.into(), Some(self.group.clone()));
162161

163162
let mut info = AssistInfo::new(label).with_group(self.group.clone());
164163
if self.ctx.should_compute_edit {

crates/ra_assists/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,17 @@ pub struct AssistLabel {
3535
pub id: AssistId,
3636
/// Short description of the assist, as shown in the UI.
3737
pub label: String,
38+
pub group: Option<GroupLabel>,
3839
}
3940

4041
#[derive(Clone, Debug)]
4142
pub struct GroupLabel(pub String);
4243

4344
impl AssistLabel {
44-
pub(crate) fn new(id: AssistId, label: String) -> AssistLabel {
45+
pub(crate) fn new(id: AssistId, label: String, group: Option<GroupLabel>) -> AssistLabel {
4546
// FIXME: make fields private, so that this invariant can't be broken
4647
assert!(label.starts_with(|c: char| c.is_uppercase()));
47-
AssistLabel { label, id }
48+
AssistLabel { id, label, group }
4849
}
4950
}
5051

@@ -60,7 +61,6 @@ pub struct AssistAction {
6061
#[derive(Debug, Clone)]
6162
pub struct ResolvedAssist {
6263
pub label: AssistLabel,
63-
pub group_label: Option<GroupLabel>,
6464
pub action: AssistAction,
6565
}
6666

0 commit comments

Comments
 (0)