rust/crates
bors[bot] 5664a2b0b3
Merge #9814
9814: Generate default impl when converting `#[derive(Debug)]` to manual impl r=yoshuawuyts a=yoshuawuyts

This patch makes it so when you convert `#[derive(Debug)]` to a manual impl, a default body is provided that's equivalent to the original output of `#[derive(Debug)]`. This should make it drastically easier to write custom `Debug` impls, especially when all you want to do is quickly omit a single field which is `!Debug`.

This is implemented for enums, record structs, tuple structs, empty structs - and it sets us up to implement variations on this in the future for other traits (like `PartialEq` and `Hash`).

Thanks!

## Codegen diff
This is the difference in codegen for record structs with this patch:
```diff
struct Foo {
    bar: String,
}

impl fmt::Debug for Foo {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        todo!();
+        f.debug_struct("Foo").field("bar", &self.bar).finish()
    }
}
```

Co-authored-by: Irina Shestak <shestak.irina@gmail.com>
Co-authored-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
Co-authored-by: Yoshua Wuyts <yoshuawuyts+github@gmail.com>
2021-08-08 22:30:37 +00:00
..
base_db Complete editable private items 2021-07-23 19:57:16 +02:00
cfg internal: add simple smoke test for project model 2021-07-20 16:23:57 +03:00
flycheck internal: a bit more of cwd safety for flycheck 2021-07-17 18:13:35 +03:00
hir Add reference here diagnostic 2021-08-08 10:12:40 +02:00
hir_def Look for enum variants and trait assoc functions when looking for lang items 2021-08-07 22:30:13 +02:00
hir_expand Implement if_to_bool_then assist 2021-08-08 17:56:34 +02:00
hir_ty Increase chalk overflow depth 2021-08-08 18:40:28 +03:00
ide Use minicore 2021-08-08 18:58:42 +02:00
ide_assists Merge #9814 2021-08-08 22:30:37 +00:00
ide_completion fix: add ! to macro completions with existing arg 2021-08-08 15:53:31 +03:00
ide_db Remove unused structs in ide_db 2021-08-05 12:04:37 +01:00
ide_diagnostics Merge #9810 2021-08-08 10:35:00 +00:00
ide_ssr Give TypeInfo fields and methods more appropriate names 2021-08-03 17:28:51 +02:00
limit internal: add API to check what are the max limits in practice 2021-07-31 18:26:43 +03:00
mbe minor: drop dummy authors field 2021-07-05 14:19:41 +03:00
parser Split the test 2021-08-04 03:01:48 -07:00
paths Fix AbsPath::ends_with 2021-07-18 10:25:14 +03:00
proc_macro_api Replace useless types 2021-07-31 14:29:15 +02:00
proc_macro_srv Copy the proc_macro crate for the 1.56 ABI 2021-08-07 16:34:59 +01:00
proc_macro_test cargo_metadata 0.14 2021-07-09 11:01:55 -04:00
profile internal: make non-zero times stand out in profile 2021-07-31 16:22:03 +03:00
project_model Rust project project model smoke tests 2021-08-01 15:00:34 -07:00
rust-analyzer exclude files from tidy check 2021-08-08 18:44:54 +02:00
sourcegen minor: make sure that project_root works correctly 2021-07-13 15:02:29 +03:00
stdx Remove proc macro management thread 2021-07-08 16:43:39 +02:00
syntax Merge #9814 2021-08-08 22:30:37 +00:00
test_utils Update crates/test_utils/src/minicore.rs 2021-08-09 00:00:09 +02:00
text_edit minor: drop dummy authors field 2021-07-05 14:19:41 +03:00
toolchain minor: drop dummy authors field 2021-07-05 14:19:41 +03:00
tt minor: drop dummy authors field 2021-07-05 14:19:41 +03:00
vfs internal: make it easier to isolate IO 2021-07-17 17:55:16 +03:00
vfs-notify Downgrade notify and use RecommendedWatcher 2021-08-03 14:33:37 +03:00