From 5a2ef8d0cad71cf51da548b80bcfb4ba615061d1 Mon Sep 17 00:00:00 2001 From: ivan770 Date: Sat, 27 Mar 2021 11:37:39 +0200 Subject: Added support for const generics in impl generation --- crates/ide_assists/src/handlers/generate_impl.rs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'crates/ide_assists/src/handlers') diff --git a/crates/ide_assists/src/handlers/generate_impl.rs b/crates/ide_assists/src/handlers/generate_impl.rs index a8e3c4fc2..fd2e250bc 100644 --- a/crates/ide_assists/src/handlers/generate_impl.rs +++ b/crates/ide_assists/src/handlers/generate_impl.rs @@ -69,6 +69,17 @@ mod tests { "struct Foo<'a, T: Foo<'a>> {$0}", "struct Foo<'a, T: Foo<'a>> {}\n\nimpl<'a, T: Foo<'a>> Foo<'a, T> {\n $0\n}", ); + check_assist( + generate_impl, + r#" + struct MyOwnArray {}$0"#, + r#" + struct MyOwnArray {} + + impl MyOwnArray { + $0 + }"#, + ); check_assist( generate_impl, r#" @@ -114,11 +125,11 @@ mod tests { check_assist( generate_impl, r#" - struct Defaulted<'a, 'b: 'a, T: Debug + Clone + 'a + 'b = String> {}$0"#, + struct Defaulted<'a, 'b: 'a, T: Debug + Clone + 'a + 'b = String, const S: usize> {}$0"#, r#" - struct Defaulted<'a, 'b: 'a, T: Debug + Clone + 'a + 'b = String> {} + struct Defaulted<'a, 'b: 'a, T: Debug + Clone + 'a + 'b = String, const S: usize> {} - impl<'a, 'b: 'a, T: Debug + Clone + 'a + 'b> Defaulted<'a, 'b, T> { + impl<'a, 'b: 'a, T: Debug + Clone + 'a + 'b, const S: usize> Defaulted<'a, 'b, T, S> { $0 }"#, ); -- cgit v1.2.3