fix(rsx): quote_spanned! -> quote!. Resolves clippy::useless_format lints.#5636
fix(rsx): quote_spanned! -> quote!. Resolves clippy::useless_format lints.#5636scottfones wants to merge 1 commit into
quote_spanned! -> quote!. Resolves clippy::useless_format lints.#5636Conversation
|
We forward the span to help rust analyzers highlighting/rename functionality. We should keep the span and |
|
Thanks for the quick feedback @ealmloff ! I saw the comment about the RA functionality and wanted to maintain that with the fix. I did test that highlighting and renaming work. My understanding is that the interpolated Here's the code I'm testing on: use dioxus::prelude::*;
pub fn render(renamed: &str) -> Element {
rsx! {
span { "{renamed}" }
}
}Here, I also tested a I'm happy to go with the allow attribute if you still prefer that. |
10004c6 to
3761d72
Compare
|
I've updated the commit, which should fix the CI. The first commit was a hybrid of the original code and my fix; I messed up when I was cleaning up my edits. I left the The corrected line is Sorry for the mix up. |
Problem
ifmt.rs'sis_simple_exprpath emitsformat!withquote_spanned! { raw.span() => ... }, giving the call the user's source span. After rust-lang/rust-clippy#17060 ,useless_formatresolves aformat!'s macro context from its span, so clippy isn't aware of the call's macro-generated context.Fix
Using
quote!gives it the macro's span instead, so clippy treats it as part of thersx!expansion and ignores it.The
#rawliteral keeps its source span, so rust-analyzer is unaffected.Verification
Confirmed: clippy no longer lints bare interpolations as before.
Confirmed rust-analyzer functionality in-editor: renaming a variable still rewrites its
"{var}"insidersx!.Fixes #5635