From cda6355de23825c201d02e6062cb2dd414e98bf9 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 27 Oct 2019 17:35:37 +0300 Subject: simplify AssistCtx API We never actually use ability to create multiple actions out of a single context --- crates/ra_assists/src/assist_ctx.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'crates/ra_assists/src/assist_ctx.rs') diff --git a/crates/ra_assists/src/assist_ctx.rs b/crates/ra_assists/src/assist_ctx.rs index c52736679..c5e9056af 100644 --- a/crates/ra_assists/src/assist_ctx.rs +++ b/crates/ra_assists/src/assist_ctx.rs @@ -82,12 +82,12 @@ impl<'a, DB: HirDatabase> AssistCtx<'a, DB> { f(ctx) } - pub(crate) fn add_action( - &mut self, + pub(crate) fn add_assist( + mut self, id: AssistId, label: impl Into, f: impl FnOnce(&mut AssistBuilder), - ) -> &mut Self { + ) -> Option { let label = AssistLabel { label: label.into(), id }; match &mut self.assist { Assist::Unresolved(labels) => labels.push(label), @@ -100,10 +100,6 @@ impl<'a, DB: HirDatabase> AssistCtx<'a, DB> { labels_actions.push((label, action)); } } - self - } - - pub(crate) fn build(self) -> Option { Some(self.assist) } -- cgit v1.2.3