mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 13:03:31 +00:00
Change add_function assist to use todo!()
This commit is contained in:
parent
c82e7696e6
commit
1231418f31
4 changed files with 30 additions and 29 deletions
|
@ -78,7 +78,7 @@ fn foo() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn bar(arg: &str, baz: Baz) {
|
fn bar(arg: &str, baz: Baz) {
|
||||||
unimplemented!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
"#####,
|
"#####,
|
||||||
|
|
|
@ -29,7 +29,7 @@ use rustc_hash::{FxHashMap, FxHashSet};
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// fn bar(arg: &str, baz: Baz) {
|
// fn bar(arg: &str, baz: Baz) {
|
||||||
// unimplemented!()
|
// todo!()
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// ```
|
// ```
|
||||||
|
@ -80,7 +80,7 @@ impl FunctionBuilder {
|
||||||
Some(Self { append_fn_at, fn_name, type_params, params })
|
Some(Self { append_fn_at, fn_name, type_params, params })
|
||||||
}
|
}
|
||||||
fn render(self) -> Option<FunctionTemplate> {
|
fn render(self) -> Option<FunctionTemplate> {
|
||||||
let placeholder_expr = ast::make::expr_unimplemented();
|
let placeholder_expr = ast::make::expr_todo();
|
||||||
let fn_body = ast::make::block_expr(vec![], Some(placeholder_expr));
|
let fn_body = ast::make::block_expr(vec![], Some(placeholder_expr));
|
||||||
let fn_def = ast::make::fn_def(self.fn_name, self.type_params, self.params, fn_body);
|
let fn_def = ast::make::fn_def(self.fn_name, self.type_params, self.params, fn_body);
|
||||||
let fn_def = ast::make::add_newlines(2, fn_def);
|
let fn_def = ast::make::add_newlines(2, fn_def);
|
||||||
|
@ -225,7 +225,7 @@ fn foo() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn bar() {
|
fn bar() {
|
||||||
<|>unimplemented!()
|
<|>todo!()
|
||||||
}
|
}
|
||||||
",
|
",
|
||||||
)
|
)
|
||||||
|
@ -252,7 +252,7 @@ impl Foo {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn bar() {
|
fn bar() {
|
||||||
<|>unimplemented!()
|
<|>todo!()
|
||||||
}
|
}
|
||||||
",
|
",
|
||||||
)
|
)
|
||||||
|
@ -276,7 +276,7 @@ fn foo1() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn bar() {
|
fn bar() {
|
||||||
<|>unimplemented!()
|
<|>todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn foo2() {}
|
fn foo2() {}
|
||||||
|
@ -302,7 +302,7 @@ mod baz {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn bar() {
|
fn bar() {
|
||||||
<|>unimplemented!()
|
<|>todo!()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
",
|
",
|
||||||
|
@ -315,20 +315,20 @@ mod baz {
|
||||||
add_function,
|
add_function,
|
||||||
r"
|
r"
|
||||||
struct Baz;
|
struct Baz;
|
||||||
fn baz() -> Baz { unimplemented!() }
|
fn baz() -> Baz { todo!() }
|
||||||
fn foo() {
|
fn foo() {
|
||||||
bar<|>(baz());
|
bar<|>(baz());
|
||||||
}
|
}
|
||||||
",
|
",
|
||||||
r"
|
r"
|
||||||
struct Baz;
|
struct Baz;
|
||||||
fn baz() -> Baz { unimplemented!() }
|
fn baz() -> Baz { todo!() }
|
||||||
fn foo() {
|
fn foo() {
|
||||||
bar(baz());
|
bar(baz());
|
||||||
}
|
}
|
||||||
|
|
||||||
fn bar(baz: Baz) {
|
fn bar(baz: Baz) {
|
||||||
<|>unimplemented!()
|
<|>todo!()
|
||||||
}
|
}
|
||||||
",
|
",
|
||||||
);
|
);
|
||||||
|
@ -361,7 +361,7 @@ impl Baz {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn bar(baz: Baz) {
|
fn bar(baz: Baz) {
|
||||||
<|>unimplemented!()
|
<|>todo!()
|
||||||
}
|
}
|
||||||
",
|
",
|
||||||
)
|
)
|
||||||
|
@ -382,7 +382,7 @@ fn foo() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn bar(arg: &str) {
|
fn bar(arg: &str) {
|
||||||
<|>unimplemented!()
|
<|>todo!()
|
||||||
}
|
}
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
|
@ -403,7 +403,7 @@ fn foo() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn bar(arg: char) {
|
fn bar(arg: char) {
|
||||||
<|>unimplemented!()
|
<|>todo!()
|
||||||
}
|
}
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
|
@ -424,7 +424,7 @@ fn foo() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn bar(arg: i32) {
|
fn bar(arg: i32) {
|
||||||
<|>unimplemented!()
|
<|>todo!()
|
||||||
}
|
}
|
||||||
",
|
",
|
||||||
)
|
)
|
||||||
|
@ -445,7 +445,7 @@ fn foo() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn bar(arg: u8) {
|
fn bar(arg: u8) {
|
||||||
<|>unimplemented!()
|
<|>todo!()
|
||||||
}
|
}
|
||||||
",
|
",
|
||||||
)
|
)
|
||||||
|
@ -470,7 +470,7 @@ fn foo() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn bar(x: u8) {
|
fn bar(x: u8) {
|
||||||
<|>unimplemented!()
|
<|>todo!()
|
||||||
}
|
}
|
||||||
",
|
",
|
||||||
)
|
)
|
||||||
|
@ -493,7 +493,7 @@ fn foo() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn bar(worble: ()) {
|
fn bar(worble: ()) {
|
||||||
<|>unimplemented!()
|
<|>todo!()
|
||||||
}
|
}
|
||||||
",
|
",
|
||||||
)
|
)
|
||||||
|
@ -506,7 +506,7 @@ fn bar(worble: ()) {
|
||||||
r"
|
r"
|
||||||
trait Foo {}
|
trait Foo {}
|
||||||
fn foo() -> impl Foo {
|
fn foo() -> impl Foo {
|
||||||
unimplemented!()
|
todo!()
|
||||||
}
|
}
|
||||||
fn baz() {
|
fn baz() {
|
||||||
<|>bar(foo())
|
<|>bar(foo())
|
||||||
|
@ -515,14 +515,14 @@ fn baz() {
|
||||||
r"
|
r"
|
||||||
trait Foo {}
|
trait Foo {}
|
||||||
fn foo() -> impl Foo {
|
fn foo() -> impl Foo {
|
||||||
unimplemented!()
|
todo!()
|
||||||
}
|
}
|
||||||
fn baz() {
|
fn baz() {
|
||||||
bar(foo())
|
bar(foo())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn bar(foo: impl Foo) {
|
fn bar(foo: impl Foo) {
|
||||||
<|>unimplemented!()
|
<|>todo!()
|
||||||
}
|
}
|
||||||
",
|
",
|
||||||
)
|
)
|
||||||
|
@ -556,7 +556,7 @@ mod Foo {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn bar(baz: super::Baz::Bof) {
|
fn bar(baz: super::Baz::Bof) {
|
||||||
<|>unimplemented!()
|
<|>todo!()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
",
|
",
|
||||||
|
@ -580,7 +580,7 @@ fn foo<T>(t: T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn bar<T>(t: T) {
|
fn bar<T>(t: T) {
|
||||||
<|>unimplemented!()
|
<|>todo!()
|
||||||
}
|
}
|
||||||
",
|
",
|
||||||
)
|
)
|
||||||
|
@ -611,7 +611,7 @@ fn foo() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn bar(arg: fn() -> Baz) {
|
fn bar(arg: fn() -> Baz) {
|
||||||
<|>unimplemented!()
|
<|>todo!()
|
||||||
}
|
}
|
||||||
",
|
",
|
||||||
)
|
)
|
||||||
|
@ -636,7 +636,7 @@ fn foo() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn bar(closure: impl Fn(i64) -> i64) {
|
fn bar(closure: impl Fn(i64) -> i64) {
|
||||||
<|>unimplemented!()
|
<|>todo!()
|
||||||
}
|
}
|
||||||
",
|
",
|
||||||
)
|
)
|
||||||
|
@ -657,7 +657,7 @@ fn foo() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn bar(baz: ()) {
|
fn bar(baz: ()) {
|
||||||
<|>unimplemented!()
|
<|>todo!()
|
||||||
}
|
}
|
||||||
",
|
",
|
||||||
)
|
)
|
||||||
|
@ -682,7 +682,7 @@ fn foo() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn bar(baz_1: Baz, baz_2: Baz) {
|
fn bar(baz_1: Baz, baz_2: Baz) {
|
||||||
<|>unimplemented!()
|
<|>todo!()
|
||||||
}
|
}
|
||||||
",
|
",
|
||||||
)
|
)
|
||||||
|
@ -707,7 +707,7 @@ fn foo() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn bar(baz_1: Baz, baz_2: Baz, arg_1: &str, arg_2: &str) {
|
fn bar(baz_1: Baz, baz_2: Baz, arg_1: &str, arg_2: &str) {
|
||||||
<|>unimplemented!()
|
<|>todo!()
|
||||||
}
|
}
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
|
@ -779,7 +779,7 @@ impl Foo {
|
||||||
self.bar();
|
self.bar();
|
||||||
}
|
}
|
||||||
fn bar(&self) {
|
fn bar(&self) {
|
||||||
unimplemented!();
|
todo!();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
",
|
",
|
||||||
|
|
|
@ -77,7 +77,7 @@ fn foo() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn bar(arg: &str, baz: Baz) {
|
fn bar(arg: &str, baz: Baz) {
|
||||||
unimplemented!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
|
@ -26,6 +26,7 @@ fn check_todo(path: &Path, text: &str) {
|
||||||
// Some of our assists generate `todo!()` so those files are whitelisted.
|
// Some of our assists generate `todo!()` so those files are whitelisted.
|
||||||
"doc_tests/generated.rs",
|
"doc_tests/generated.rs",
|
||||||
"handlers/add_missing_impl_members.rs",
|
"handlers/add_missing_impl_members.rs",
|
||||||
|
"handlers/add_function.rs",
|
||||||
// To support generating `todo!()` in assists, we have `expr_todo()` in ast::make.
|
// To support generating `todo!()` in assists, we have `expr_todo()` in ast::make.
|
||||||
"ast/make.rs",
|
"ast/make.rs",
|
||||||
];
|
];
|
||||||
|
|
Loading…
Reference in a new issue