Skip to content

Commit 923efa7

Browse files
Merge #3969
3969: Change add_function assist to use todo!() instead of unimplemented!() r=matklad a=TimoFreiberg In the spirit of #3935 Co-authored-by: Timo Freiberg <[email protected]>
2 parents 61cb87e + 1231418 commit 923efa7

File tree

4 files changed

+30
-29
lines changed

4 files changed

+30
-29
lines changed

crates/ra_assists/src/doc_tests/generated.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ fn foo() {
7878
}
7979
8080
fn bar(arg: &str, baz: Baz) {
81-
unimplemented!()
81+
todo!()
8282
}
8383
8484
"#####,

crates/ra_assists/src/handlers/add_function.rs

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use rustc_hash::{FxHashMap, FxHashSet};
2929
// }
3030
//
3131
// fn bar(arg: &str, baz: Baz) {
32-
// unimplemented!()
32+
// todo!()
3333
// }
3434
//
3535
// ```
@@ -80,7 +80,7 @@ impl FunctionBuilder {
8080
Some(Self { append_fn_at, fn_name, type_params, params })
8181
}
8282
fn render(self) -> Option<FunctionTemplate> {
83-
let placeholder_expr = ast::make::expr_unimplemented();
83+
let placeholder_expr = ast::make::expr_todo();
8484
let fn_body = ast::make::block_expr(vec![], Some(placeholder_expr));
8585
let fn_def = ast::make::fn_def(self.fn_name, self.type_params, self.params, fn_body);
8686
let fn_def = ast::make::add_newlines(2, fn_def);
@@ -225,7 +225,7 @@ fn foo() {
225225
}
226226
227227
fn bar() {
228-
<|>unimplemented!()
228+
<|>todo!()
229229
}
230230
",
231231
)
@@ -252,7 +252,7 @@ impl Foo {
252252
}
253253
254254
fn bar() {
255-
<|>unimplemented!()
255+
<|>todo!()
256256
}
257257
",
258258
)
@@ -276,7 +276,7 @@ fn foo1() {
276276
}
277277
278278
fn bar() {
279-
<|>unimplemented!()
279+
<|>todo!()
280280
}
281281
282282
fn foo2() {}
@@ -302,7 +302,7 @@ mod baz {
302302
}
303303
304304
fn bar() {
305-
<|>unimplemented!()
305+
<|>todo!()
306306
}
307307
}
308308
",
@@ -315,20 +315,20 @@ mod baz {
315315
add_function,
316316
r"
317317
struct Baz;
318-
fn baz() -> Baz { unimplemented!() }
318+
fn baz() -> Baz { todo!() }
319319
fn foo() {
320320
bar<|>(baz());
321321
}
322322
",
323323
r"
324324
struct Baz;
325-
fn baz() -> Baz { unimplemented!() }
325+
fn baz() -> Baz { todo!() }
326326
fn foo() {
327327
bar(baz());
328328
}
329329
330330
fn bar(baz: Baz) {
331-
<|>unimplemented!()
331+
<|>todo!()
332332
}
333333
",
334334
);
@@ -361,7 +361,7 @@ impl Baz {
361361
}
362362
363363
fn bar(baz: Baz) {
364-
<|>unimplemented!()
364+
<|>todo!()
365365
}
366366
",
367367
)
@@ -382,7 +382,7 @@ fn foo() {
382382
}
383383
384384
fn bar(arg: &str) {
385-
<|>unimplemented!()
385+
<|>todo!()
386386
}
387387
"#,
388388
)
@@ -403,7 +403,7 @@ fn foo() {
403403
}
404404
405405
fn bar(arg: char) {
406-
<|>unimplemented!()
406+
<|>todo!()
407407
}
408408
"#,
409409
)
@@ -424,7 +424,7 @@ fn foo() {
424424
}
425425
426426
fn bar(arg: i32) {
427-
<|>unimplemented!()
427+
<|>todo!()
428428
}
429429
",
430430
)
@@ -445,7 +445,7 @@ fn foo() {
445445
}
446446
447447
fn bar(arg: u8) {
448-
<|>unimplemented!()
448+
<|>todo!()
449449
}
450450
",
451451
)
@@ -470,7 +470,7 @@ fn foo() {
470470
}
471471
472472
fn bar(x: u8) {
473-
<|>unimplemented!()
473+
<|>todo!()
474474
}
475475
",
476476
)
@@ -493,7 +493,7 @@ fn foo() {
493493
}
494494
495495
fn bar(worble: ()) {
496-
<|>unimplemented!()
496+
<|>todo!()
497497
}
498498
",
499499
)
@@ -506,7 +506,7 @@ fn bar(worble: ()) {
506506
r"
507507
trait Foo {}
508508
fn foo() -> impl Foo {
509-
unimplemented!()
509+
todo!()
510510
}
511511
fn baz() {
512512
<|>bar(foo())
@@ -515,14 +515,14 @@ fn baz() {
515515
r"
516516
trait Foo {}
517517
fn foo() -> impl Foo {
518-
unimplemented!()
518+
todo!()
519519
}
520520
fn baz() {
521521
bar(foo())
522522
}
523523
524524
fn bar(foo: impl Foo) {
525-
<|>unimplemented!()
525+
<|>todo!()
526526
}
527527
",
528528
)
@@ -556,7 +556,7 @@ mod Foo {
556556
}
557557
558558
fn bar(baz: super::Baz::Bof) {
559-
<|>unimplemented!()
559+
<|>todo!()
560560
}
561561
}
562562
",
@@ -580,7 +580,7 @@ fn foo<T>(t: T) {
580580
}
581581
582582
fn bar<T>(t: T) {
583-
<|>unimplemented!()
583+
<|>todo!()
584584
}
585585
",
586586
)
@@ -611,7 +611,7 @@ fn foo() {
611611
}
612612
613613
fn bar(arg: fn() -> Baz) {
614-
<|>unimplemented!()
614+
<|>todo!()
615615
}
616616
",
617617
)
@@ -636,7 +636,7 @@ fn foo() {
636636
}
637637
638638
fn bar(closure: impl Fn(i64) -> i64) {
639-
<|>unimplemented!()
639+
<|>todo!()
640640
}
641641
",
642642
)
@@ -657,7 +657,7 @@ fn foo() {
657657
}
658658
659659
fn bar(baz: ()) {
660-
<|>unimplemented!()
660+
<|>todo!()
661661
}
662662
",
663663
)
@@ -682,7 +682,7 @@ fn foo() {
682682
}
683683
684684
fn bar(baz_1: Baz, baz_2: Baz) {
685-
<|>unimplemented!()
685+
<|>todo!()
686686
}
687687
",
688688
)
@@ -707,7 +707,7 @@ fn foo() {
707707
}
708708
709709
fn bar(baz_1: Baz, baz_2: Baz, arg_1: &str, arg_2: &str) {
710-
<|>unimplemented!()
710+
<|>todo!()
711711
}
712712
"#,
713713
)
@@ -779,7 +779,7 @@ impl Foo {
779779
self.bar();
780780
}
781781
fn bar(&self) {
782-
unimplemented!();
782+
todo!();
783783
}
784784
}
785785
",

docs/user/assists.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ fn foo() {
7777
}
7878

7979
fn bar(arg: &str, baz: Baz) {
80-
unimplemented!()
80+
todo!()
8181
}
8282

8383
```

xtask/tests/tidy-tests/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ fn check_todo(path: &Path, text: &str) {
2626
// Some of our assists generate `todo!()` so those files are whitelisted.
2727
"doc_tests/generated.rs",
2828
"handlers/add_missing_impl_members.rs",
29+
"handlers/add_function.rs",
2930
// To support generating `todo!()` in assists, we have `expr_todo()` in ast::make.
3031
"ast/make.rs",
3132
];

0 commit comments

Comments
 (0)