Skip to content

Commit 527ed05

Browse files
authored
fix: avoid rust-analyzer snake case warning
It seems that rust-analyzer needs to operate over the expanded text of the proc macro (in order to e.g. support completion in the function body, see #11014 for way more details), so it "sees" the non-snake-case name emitted by riscv-rt's `entry` here. Without this change, rust-analyzer will show a "weak warning" on invocations of `#[entry]` with the text: ``` Function `__risc_v_rt__main` should have snake_case name, e.g. `__risc_v_rt_main` ```
1 parent e48c03e commit 527ed05

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

riscv-rt/macros/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ pub fn entry(args: TokenStream, input: TokenStream) -> TokenStream {
109109
let stmts = f.block.stmts;
110110

111111
quote!(
112+
#[allow(non_snake_case)]
112113
#[export_name = "main"]
113114
#(#attrs)*
114115
pub #unsafety fn __risc_v_rt__main(#args) -> ! {

0 commit comments

Comments
 (0)