Skip to content

Commit eb8ace4

Browse files
committed
simplify macro gen code
1 parent 1d79e8b commit eb8ace4

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

dioxus-code-macro/src/lib.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -334,14 +334,14 @@ fn expand_shared(
334334
};
335335
let variant_ident = Ident::new(variant, Span::call_site());
336336

337-
let source_decl = match origin_path {
337+
let source_expr = match origin_path {
338338
Some(path) => {
339339
let path_lit = LitStr::new(&path.to_string_lossy(), Span::call_site());
340-
quote! { const SOURCE: &str = include_str!(#path_lit); }
340+
quote! { include_str!(#path_lit) }
341341
}
342342
None => {
343343
let source_lit = LitStr::new(&source, Span::call_site());
344-
quote! { const SOURCE: &str = #source_lit; }
344+
quote! { #source_lit }
345345
}
346346
};
347347

@@ -356,8 +356,8 @@ fn expand_shared(
356356

357357
Ok(quote! {{
358358
#options_check
359-
#source_decl
360-
static SPANS: &[#crate_path::advanced::HighlightSpan] = &[#(#span_tokens),*];
359+
const SOURCE: &str = #source_expr;
360+
const SPANS: &[#crate_path::advanced::HighlightSpan] = &[#(#span_tokens),*];
361361
#crate_path::advanced::HighlightedSource::from_static_parts(
362362
SOURCE,
363363
#crate_path::Language::#variant_ident,

0 commit comments

Comments
 (0)