From d8559588c0a38ef1c2cfcb297b520469e6765c80 Mon Sep 17 00:00:00 2001 From: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com> Date: Sat, 20 Feb 2021 15:05:01 +0100 Subject: fix(assist): display where predicates when we want to generate impl Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com> --- crates/assists/src/utils.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'crates/assists/src/utils.rs') diff --git a/crates/assists/src/utils.rs b/crates/assists/src/utils.rs index 8418e6e12..0074da741 100644 --- a/crates/assists/src/utils.rs +++ b/crates/assists/src/utils.rs @@ -421,7 +421,14 @@ fn generate_impl_text_inner(adt: &ast::Adt, trait_text: Option<&str>, code: &str format_to!(buf, "<{}>", lifetime_params.chain(type_params).format(", ")) } - format_to!(buf, " {{\n{}\n}}", code); + match adt.where_clause() { + Some(where_clause) => { + format_to!(buf, "\n{}\n{{\n{}\n}}", where_clause, code); + } + None => { + format_to!(buf, " {{\n{}\n}}", code); + } + } buf } -- cgit v1.2.3