Skip to content

rustfmt strips all param attrs #3819

Description

@bbqsrc

To reproduce: get this repo, https://github.com/bbqsrc/params-attribute-example, run cargo fmt, then git diff.

diff --git a/proc-macro-tests/rename_params.rs b/proc-macro-tests/rename_params.rs
index 23f3e59..b70730c 100644
--- a/proc-macro-tests/rename_params.rs
+++ b/proc-macro-tests/rename_params.rs
@@ -2,11 +2,11 @@
 use params_attribute_example::rename_params;

 #[rename_params(send_help)]
-fn hello(#[angery(true)] a: i32, #[a2] b: i32, #[what = "how"] c: u32) {}
+fn hello(a: i32, b: i32, c: u32) {}

 #[rename_params(send_help)]
 impl Foo {
-  fn hello(#[angery(true)] a: i32, #[a2] b: i32, #[what = "how"] c: u32) {}
-  fn hello2(#[a1] #[a2] a: i32, #[what = "how"] b: i32, #[angery(true)] c: u32) {}
-  fn hello_self(#[a1] #[a2] &self, #[a1] #[a2] a: i32, #[what = "how"] b: i32, #[angery(true)]c: u32) {}
-}
\ No newline at end of file
+    fn hello(a: i32, b: i32, c: u32) {}
+    fn hello2(a: i32, b: i32, c: u32) {}
+    fn hello_self(&self, a: i32, b: i32, c: u32) {}
+}

It consumes all. :)

$ cargo fmt --version
rustfmt 1.4.8-nightly (afb1ee1c 2019-09-08)

This may be related to: rust-lang/rust#64682, but may simply be that rustfmt hasn't caught up with rust-lang/rust#64010 yet.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions