danielpclark / rutie

“The Tie Between Ruby and Rust.”
MIT License
940 stars 62 forks source link

Cargo fmt keeps adding commas after methods definition at methods! macro #120

Closed abinoam closed 3 years ago

abinoam commented 4 years ago

Is it possible to make the methods! (and unsafe_methods!) macro accept both with or without commas? (This would help a Rust/Rutie newbie like me)

It would be desirable to have this possibility? (Or is there another way to tackle this situation? A cargo fmt configuration, for example?)

Is it easily accomplish-able? If so, I could study Rust macros and try to open a PR myself.

Bellow a git diff after a cargo fmt

diff --git a/src/lib.rs b/src/lib.rs
index c6f733c..83fdde3 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -73,14 +73,12 @@ methods!(
         }

         array
-    }
-
+    },
     fn pub_to_s() -> RString {
         let matrix_str = rtself.get_data(&*MATRIX_WRAPPER_INSTANCE).to_s();

         RString::from(matrix_str)
-    }
-
+    },
     fn pub_dot(other: MatrixRs) -> MatrixRs {
         let other = other.unwrap_or_rb_raise();
         let other_matrix = other.get_data(&*MATRIX_WRAPPER_INSTANCE);
danielpclark commented 3 years ago

@abinoam I believe @gemmaro has solved this issue and this is now in v0.8.2.