diff options
author | Aleksey Kladov <[email protected]> | 2020-05-05 19:30:33 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-05-05 19:30:33 +0100 |
commit | 13c078db9cba8bbbf48918a928cd2533571a7f5d (patch) | |
tree | e3900b8f132c4dc4260a2154334b91ec93576edd /crates/ra_assists/src | |
parent | 8803e748a627f2ff45d441e70b3deda3f038c40e (diff) |
Flip Assist::new arguments
Diffstat (limited to 'crates/ra_assists/src')
-rw-r--r-- | crates/ra_assists/src/assist_ctx.rs | 4 | ||||
-rw-r--r-- | crates/ra_assists/src/lib.rs | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/crates/ra_assists/src/assist_ctx.rs b/crates/ra_assists/src/assist_ctx.rs index da2880037..d6f585d0e 100644 --- a/crates/ra_assists/src/assist_ctx.rs +++ b/crates/ra_assists/src/assist_ctx.rs | |||
@@ -100,7 +100,7 @@ impl<'a> AssistCtx<'a> { | |||
100 | label: impl Into<String>, | 100 | label: impl Into<String>, |
101 | f: impl FnOnce(&mut ActionBuilder), | 101 | f: impl FnOnce(&mut ActionBuilder), |
102 | ) -> Option<Assist> { | 102 | ) -> Option<Assist> { |
103 | let label = AssistLabel::new(label.into(), id); | 103 | let label = AssistLabel::new(id, label.into()); |
104 | 104 | ||
105 | let mut info = AssistInfo::new(label); | 105 | let mut info = AssistInfo::new(label); |
106 | if self.should_compute_edit { | 106 | if self.should_compute_edit { |
@@ -157,7 +157,7 @@ impl<'a> AssistGroup<'a> { | |||
157 | label: impl Into<String>, | 157 | label: impl Into<String>, |
158 | f: impl FnOnce(&mut ActionBuilder), | 158 | f: impl FnOnce(&mut ActionBuilder), |
159 | ) { | 159 | ) { |
160 | let label = AssistLabel::new(label.into(), id); | 160 | let label = AssistLabel::new(id, label.into()); |
161 | 161 | ||
162 | let mut info = AssistInfo::new(label).with_group(GroupLabel(self.group_name.clone())); | 162 | let mut info = AssistInfo::new(label).with_group(GroupLabel(self.group_name.clone())); |
163 | if self.ctx.should_compute_edit { | 163 | if self.ctx.should_compute_edit { |
diff --git a/crates/ra_assists/src/lib.rs b/crates/ra_assists/src/lib.rs index c5df86600..6156f4e2c 100644 --- a/crates/ra_assists/src/lib.rs +++ b/crates/ra_assists/src/lib.rs | |||
@@ -32,16 +32,16 @@ pub struct AssistId(pub &'static str); | |||
32 | 32 | ||
33 | #[derive(Debug, Clone)] | 33 | #[derive(Debug, Clone)] |
34 | pub struct AssistLabel { | 34 | pub struct AssistLabel { |
35 | pub id: AssistId, | ||
35 | /// Short description of the assist, as shown in the UI. | 36 | /// Short description of the assist, as shown in the UI. |
36 | pub label: String, | 37 | pub label: String, |
37 | pub id: AssistId, | ||
38 | } | 38 | } |
39 | 39 | ||
40 | #[derive(Clone, Debug)] | 40 | #[derive(Clone, Debug)] |
41 | pub struct GroupLabel(pub String); | 41 | pub struct GroupLabel(pub String); |
42 | 42 | ||
43 | impl AssistLabel { | 43 | impl AssistLabel { |
44 | pub(crate) fn new(label: String, id: AssistId) -> AssistLabel { | 44 | pub(crate) fn new(id: AssistId, label: String) -> AssistLabel { |
45 | // FIXME: make fields private, so that this invariant can't be broken | 45 | // FIXME: make fields private, so that this invariant can't be broken |
46 | assert!(label.starts_with(|c: char| c.is_uppercase())); | 46 | assert!(label.starts_with(|c: char| c.is_uppercase())); |
47 | AssistLabel { label, id } | 47 | AssistLabel { label, id } |