From 13c078db9cba8bbbf48918a928cd2533571a7f5d Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 5 May 2020 20:30:33 +0200 Subject: Flip Assist::new arguments --- crates/ra_assists/src/assist_ctx.rs | 4 ++-- crates/ra_assists/src/lib.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'crates/ra_assists/src') 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> { label: impl Into, f: impl FnOnce(&mut ActionBuilder), ) -> Option { - let label = AssistLabel::new(label.into(), id); + let label = AssistLabel::new(id, label.into()); let mut info = AssistInfo::new(label); if self.should_compute_edit { @@ -157,7 +157,7 @@ impl<'a> AssistGroup<'a> { label: impl Into, f: impl FnOnce(&mut ActionBuilder), ) { - let label = AssistLabel::new(label.into(), id); + let label = AssistLabel::new(id, label.into()); let mut info = AssistInfo::new(label).with_group(GroupLabel(self.group_name.clone())); 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); #[derive(Debug, Clone)] pub struct AssistLabel { + pub id: AssistId, /// Short description of the assist, as shown in the UI. pub label: String, - pub id: AssistId, } #[derive(Clone, Debug)] pub struct GroupLabel(pub String); impl AssistLabel { - pub(crate) fn new(label: String, id: AssistId) -> AssistLabel { + pub(crate) fn new(id: AssistId, label: String) -> AssistLabel { // FIXME: make fields private, so that this invariant can't be broken assert!(label.starts_with(|c: char| c.is_uppercase())); AssistLabel { label, id } -- cgit v1.2.3