Describe the bug
Adding a generic type to a derive macro deletes all derives
To Reproduce
cat <<EOF | rustfmt
#[derive(Debug, Foo<T>)]
enum Bar{}
EOF
This produces the following output, removing all derive attributes:
#[derive()]
enum Bar {}
Expected behavior
Something less nefarious, like rustc's
error: malformed `derive` attribute input
Meta
Just noticed this as well:
#[derive(Debug, , Default)]
struct Struct(i32);
turns into this:
#[derive()]
struct Struct(i32);
which is bizarre when you're deleting one of the derives and you save partway through!
This has been fixed in source but not backported to a released version. Will try to do so for the upcoming 1.4.28 release
Closing as a duplicate of #3898, fix has been backported and will be in the next release
Most helpful comment
This has been fixed in source but not backported to a released version. Will try to do so for the upcoming 1.4.28 release