From 13c078db9cba8bbbf48918a928cd2533571a7f5d Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 5 May 2020 20:30:33 +0200 Subject: [PATCH] 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(-) diff --git a/crates/ra_assists/src/assist_ctx.rs b/crates/ra_assists/src/assist_ctx.rs index da288003763..d6f585d0ee6 100644 --- a/crates/ra_assists/src/assist_ctx.rs +++ b/crates/ra_assists/src/assist_ctx.rs @@ -100,7 +100,7 @@ pub(crate) fn add_assist( 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 @@ pub(crate) fn add_assist( 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 c5df86600f5..6156f4e2c50 100644 --- a/crates/ra_assists/src/lib.rs +++ b/crates/ra_assists/src/lib.rs @@ -32,16 +32,16 @@ macro_rules! eprintln { #[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 }