Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rustfmt strips all param attrs #3819

Closed
bbqsrc opened this issue Sep 30, 2019 · 1 comment
Closed

rustfmt strips all param attrs #3819

bbqsrc opened this issue Sep 30, 2019 · 1 comment

Comments

@bbqsrc
Copy link

bbqsrc commented Sep 30, 2019

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.

@calebcartwright
Copy link
Member

calebcartwright commented Sep 30, 2019

Correct, Rustfmt 1.4.9 will include support for function parameter attributes

See #3623 and #3793

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants