sqlx icon indicating copy to clipboard operation
sqlx copied to clipboard

Fix expansion of `sqlx(flatten)`

Open RustyYato opened this issue 3 years ago • 2 comments
trafficstars

Given a generic type like A<B> before sqlx would produce A<B>::from_row(row) which is invalid syntax. Now it produces <A<B> as ::sqlx::FromRow<'a, R>>. This also fixes a bug for non-generic types where an inherent method might have been called instead of the ::sqlx::FromRow::from_row method because UFCS wasn't used.

RustyYato avatar Aug 04 '22 19:08 RustyYato

I would also recommend not using a single letter generic parameter in macros because it will easily conflict with the users of the macro. (In this case I had a conflict with the chosen parameter name R). I can also update that if you think that's worthwhile to change.

RustyYato avatar Aug 04 '22 19:08 RustyYato

I can also update that if you think that's worthwhile to change.

That sounds fine, yeah.

abonander avatar Aug 04 '22 22:08 abonander