From af04d45d32b5d9bdf949beb17152ef78dd4a0523 Mon Sep 17 00:00:00 2001 From: Chris Hopman Date: Fri, 10 Apr 2020 13:41:11 -0700 Subject: Change missing impl assist to use todo!() instead of unimplemented() todo!() "Indicates unfinished code" (https://doc.rust-lang.org/std/macro.todo.html) Rust documentation provides further clarification: > The difference between unimplemented! and todo! is that while todo! > conveys an intent of implementing the functionality later and the > message is "not yet implemented", unimplemented! makes no such claims. todo!() seems more appropriate for assists that insert missing impls. --- crates/ra_assists/src/doc_tests/generated.rs | 2 +- .../src/handlers/add_missing_impl_members.rs | 34 +++++++++++----------- 2 files changed, 18 insertions(+), 18 deletions(-) (limited to 'crates/ra_assists') diff --git a/crates/ra_assists/src/doc_tests/generated.rs b/crates/ra_assists/src/doc_tests/generated.rs index 64444ee3a..24392836c 100644 --- a/crates/ra_assists/src/doc_tests/generated.rs +++ b/crates/ra_assists/src/doc_tests/generated.rs @@ -180,7 +180,7 @@ trait Trait { } impl Trait for () { - fn foo(&self) -> u32 { unimplemented!() } + fn foo(&self) -> u32 { todo!() } } "#####, diff --git a/crates/ra_assists/src/handlers/add_missing_impl_members.rs b/crates/ra_assists/src/handlers/add_missing_impl_members.rs index 722f207e2..2d6d44980 100644 --- a/crates/ra_assists/src/handlers/add_missing_impl_members.rs +++ b/crates/ra_assists/src/handlers/add_missing_impl_members.rs @@ -40,7 +40,7 @@ enum AddMissingImplMembersMode { // } // // impl Trait for () { -// fn foo(&self) -> u32 { unimplemented!() } +// fn foo(&self) -> u32 { todo!() } // // } // ``` @@ -165,7 +165,7 @@ fn add_missing_impl_members_inner( fn add_body(fn_def: ast::FnDef) -> ast::FnDef { if fn_def.body().is_none() { - fn_def.with_body(make::block_from_expr(make::expr_unimplemented())) + fn_def.with_body(make::block_from_expr(make::expr_todo())) } else { fn_def } @@ -215,8 +215,8 @@ impl Foo for S { fn bar(&self) {} <|>type Output; const CONST: usize = 42; - fn foo(&self) { unimplemented!() } - fn baz(&self) { unimplemented!() } + fn foo(&self) { todo!() } + fn baz(&self) { todo!() } }", ); @@ -250,7 +250,7 @@ struct S; impl Foo for S { fn bar(&self) {} - <|>fn foo(&self) { unimplemented!() } + <|>fn foo(&self) { todo!() } }", ); @@ -268,7 +268,7 @@ impl Foo for S { <|> }", trait Foo { fn foo(&self); } struct S; impl Foo for S { - <|>fn foo(&self) { unimplemented!() } + <|>fn foo(&self) { todo!() } }", ); } @@ -285,7 +285,7 @@ impl Foo for S { <|> }", trait Foo { fn foo(&self, t: T) -> &T; } struct S; impl Foo for S { - <|>fn foo(&self, t: u32) -> &u32 { unimplemented!() } + <|>fn foo(&self, t: u32) -> &u32 { todo!() } }", ); } @@ -302,7 +302,7 @@ impl Foo for S { <|> }", trait Foo { fn foo(&self, t: T) -> &T; } struct S; impl Foo for S { - <|>fn foo(&self, t: U) -> &U { unimplemented!() } + <|>fn foo(&self, t: U) -> &U { todo!() } }", ); } @@ -319,7 +319,7 @@ impl Foo for S {}<|>", trait Foo { fn foo(&self); } struct S; impl Foo for S { - <|>fn foo(&self) { unimplemented!() } + <|>fn foo(&self) { todo!() } }", ) } @@ -342,7 +342,7 @@ mod foo { } struct S; impl foo::Foo for S { - <|>fn foo(&self, bar: foo::Bar) { unimplemented!() } + <|>fn foo(&self, bar: foo::Bar) { todo!() } }", ); } @@ -365,7 +365,7 @@ mod foo { } struct S; impl foo::Foo for S { - <|>fn foo(&self, bar: foo::Bar) { unimplemented!() } + <|>fn foo(&self, bar: foo::Bar) { todo!() } }", ); } @@ -388,7 +388,7 @@ mod foo { } struct S; impl foo::Foo for S { - <|>fn foo(&self, bar: foo::Bar) { unimplemented!() } + <|>fn foo(&self, bar: foo::Bar) { todo!() } }", ); } @@ -414,7 +414,7 @@ mod foo { struct Param; struct S; impl foo::Foo for S { - <|>fn foo(&self, bar: Param) { unimplemented!() } + <|>fn foo(&self, bar: Param) { todo!() } }", ); } @@ -439,7 +439,7 @@ mod foo { } struct S; impl foo::Foo for S { - <|>fn foo(&self, bar: foo::Bar::Assoc) { unimplemented!() } + <|>fn foo(&self, bar: foo::Bar::Assoc) { todo!() } }", ); } @@ -464,7 +464,7 @@ mod foo { } struct S; impl foo::Foo for S { - <|>fn foo(&self, bar: foo::Bar) { unimplemented!() } + <|>fn foo(&self, bar: foo::Bar) { todo!() } }", ); } @@ -487,7 +487,7 @@ mod foo { } struct S; impl foo::Foo for S { - <|>fn foo(&self, bar: dyn Fn(u32) -> i32) { unimplemented!() } + <|>fn foo(&self, bar: dyn Fn(u32) -> i32) { todo!() } }", ); } @@ -544,7 +544,7 @@ trait Foo { struct S; impl Foo for S { <|>type Output; - fn foo(&self) { unimplemented!() } + fn foo(&self) { todo!() } }"#, ) } -- cgit v1.2.3