rust: fix formatting expressions
Tamir Duberstein
reviewerPATCH 1/1 rust: fix formatting expressions
From: Tamir Duberstein <[email protected]>
Allow usage like pr_info!("one + 1 = {}", one + 1) to compile by ensuring that a reference is taken to the entire expression.
---
--- rust/macros/fmt.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
rust/macros/fmt.rs +1 -1
@@ -67,7 +67,7 @@ pub(crate) fn fmt(input: TokenStream) -> TokenStream { } (None , acc) })(); - args.extend (quote_spanned! (first_span => #lhs #adapter (&#rhs))); + args.extend (quote_spanned! (first_span => #lhs #adapter (&(#rhs)))); } };
---
base-commit: f8f9c1f4d0c7a64600e2ca312dec824a0bc2f1da
change-id: 20260104-fmt-paren-e92eb804a4aa
Best regards,
Signature · 1 line
Tamir Duberstein <[email protected]>
Quoted 11 lines · Tamir Duberstein
From: Tamir Duberstein <[email protected]>
Allow usage like
pr_info!("one + 1 = {}", one + 1)to compile by ensuring that a reference is taken to the entire expression.Fixes c5cf01ba8dfe ("rust: support formatting of foreign types")Reported-by Janne Grunau <[email protected]>---
Signed-off-by Tamir Duberstein <[email protected]>
Quoted 4 lines · Tamir Duberstein
---
Signed-off-by Tamir Duberstein <[email protected]>
Thanks Tamir, I will pick it into rust-fixes alongside a bunch of other pending fixes.
Quick note in case you want to double-check your scripts: somehow you ended up with two --- lines and thus the SoB outside (no need to resend).
Cheers,
Miguel
Tamir Duberstein
reviewerQuoted 10 lines · Miguel Ojeda
Quoted 4 lines · Tamir Duberstein
---
Signed-off-by Tamir Duberstein <[email protected]>Thanks Tamir, I will pick it into
rust-fixesalongside a bunch of other pending fixes.
Quoted 6 lines
Quick note in case you want to double-check your scripts: somehow you ended up with two
---lines and thus the SoB outside (no need to resend).Cheers,
Miguel
Ah thanks for calling out - I think I just forgot to SoB the commit and so this came from the (empty) cover letter.
Thanks!
Tamir
Quoted 19 lines · Tamir Duberstein
From: Tamir Duberstein <[email protected]>
Allow usage like
pr_info!("one + 1 = {}", one + 1)to compile by ensuring that a reference is taken to the entire expression.Fixes c5cf01ba8dfe ("rust: support formatting of foreign types")Reported-by Janne Grunau <[email protected]>---
Signed-off-by Tamir Duberstein <[email protected]>--- rust/macros/fmt.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)rust/macros/fmt.rs +0
-0
rust/macros/fmt.rs pub(crate) fn fmt(input: TokenStream) -> TokenStream { · line 73
Quoted 8 lines
rust/macros/fmt.rs +1
-1@@ -67,7 +67,7 @@ pub(crate) fn fmt(input: TokenStream) -> TokenStream { } (None , acc) })(); - args.extend (quote_spanned! (first_span => #lhs #adapter (&#rhs))); + args.extend (quote_spanned! (first_span => #lhs #adapter (&(#rhs)))); } };
thanks, this fixes the trivial example I added to rust_minimal.rs and all out-of-tree use in the asahi driver where I discovered the issue.
Janne
Miguel Ojeda
AppliedQuoted 11 lines · Tamir Duberstein
From: Tamir Duberstein <[email protected]>
Allow usage like
pr_info!("one + 1 = {}", one + 1)to compile by ensuring that a reference is taken to the entire expression.Fixes c5cf01ba8dfe ("rust: support formatting of foreign types")Reported-by Janne Grunau <[email protected]>---
Signed-off-by Tamir Duberstein <[email protected]>
Applied to rust-fixes -- thanks everyone!
[ Added Signed-off-by back. Reworded title. - Miguel ]
Cheers,
Miguel
Quoted 10 lines · Tamir Duberstein
From: Tamir Duberstein <[email protected]>
Allow usage like
pr_info!("one + 1 = {}", one + 1)to compile by ensuring that a reference is taken to the entire expression.Fixes c5cf01ba8dfe ("rust: support formatting of foreign types")Reported-by Janne Grunau <[email protected]>---
Signed-off-by Tamir Duberstein <[email protected]>
Best regards,
Andreas Hindborg