Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions crates/assists/src/handlers/add_missing_impl_members.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use crate::{
//
// ```
// trait Trait<T> {
// Type X;
// type X;
// fn foo(&self) -> T;
// fn bar(&self) {}
// }
Expand All @@ -27,14 +27,16 @@ use crate::{
// ->
// ```
// trait Trait<T> {
// Type X;
// type X;
// fn foo(&self) -> T;
// fn bar(&self) {}
// }
//
// impl Trait<u32> for () {
// $0type X;
//
// fn foo(&self) -> u32 {
// ${0:todo!()}
// todo!()
// }
// }
// ```
Expand All @@ -54,27 +56,27 @@ pub(crate) fn add_missing_impl_members(acc: &mut Assists, ctx: &AssistContext) -
//
// ```
// trait Trait {
// Type X;
// type X;
// fn foo(&self);
// fn bar(&self) {}
// }
//
// impl Trait for () {
// Type X = ();
// type X = ();
// fn foo(&self) {}<|>
//
// }
// ```
// ->
// ```
// trait Trait {
// Type X;
// type X;
// fn foo(&self);
// fn bar(&self) {}
// }
//
// impl Trait for () {
// Type X = ();
// type X = ();
// fn foo(&self) {}
//
// $0fn bar(&self) {}
Expand Down
16 changes: 9 additions & 7 deletions crates/assists/src/tests/generated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,26 +42,26 @@ fn doctest_add_impl_default_members() {
"add_impl_default_members",
r#####"
trait Trait {
Type X;
type X;
fn foo(&self);
fn bar(&self) {}
}

impl Trait for () {
Type X = ();
type X = ();
fn foo(&self) {}<|>

}
"#####,
r#####"
trait Trait {
Type X;
type X;
fn foo(&self);
fn bar(&self) {}
}

impl Trait for () {
Type X = ();
type X = ();
fn foo(&self) {}

$0fn bar(&self) {}
Expand All @@ -76,7 +76,7 @@ fn doctest_add_impl_missing_members() {
"add_impl_missing_members",
r#####"
trait Trait<T> {
Type X;
type X;
fn foo(&self) -> T;
fn bar(&self) {}
}
Expand All @@ -87,14 +87,16 @@ impl Trait<u32> for () {<|>
"#####,
r#####"
trait Trait<T> {
Type X;
type X;
fn foo(&self) -> T;
fn bar(&self) {}
}

impl Trait<u32> for () {
$0type X;

fn foo(&self) -> u32 {
${0:todo!()}
todo!()
}
}
"#####,
Expand Down