@@ -35,9 +35,8 @@ fn yeet_lint(cx: &LateContext<'_>, asm: &InlineAsm<'_>, asm_span: Span, op_spans
3535
3636 span_lint_and_then ( cx, POINTER_IN_NOMEM_ASM_BLOCK , op_spans, "passing pointer to nomem asm block" , |diag| {
3737 if let Some ( probably_asm_options_span) = probably_asm_options_span {
38- diag. span_suggestion ( probably_asm_options_span, "heeelppp" , "suggg" , Applicability :: MaybeIncorrect ) ;
38+ diag. span_note ( probably_asm_options_span, "flags declared here" ) ;
3939 }
40- // note_span.inspect(|s| { diag.span_note(*s, "declared here"); });
4140 } ) ;
4241}
4342
@@ -58,21 +57,28 @@ fn check_asm(cx: &LateContext<'_>, asm: &InlineAsm<'_>, asm_span: Span) {
5857
5958declare_clippy_lint ! {
6059 /// ### What it does
60+ /// Checks if any pointer is being passed to an asm! block with `nomem` option.
6161 ///
6262 /// ### Why is this bad?
63+ /// `nomem` forbids any reads or writes to memory and passing a pointer suggests
64+ /// that either of those will happen.
6365 ///
6466 /// ### Example
6567 /// ```no_run
66- /// // example code where clippy issues a warning
68+ /// fn f(p: *mut u32) {
69+ /// unsafe { core::arch::asm!("mov [{p}], 42", p = in(reg) p, options(nomem, nostack)); }
70+ /// }
6771 /// ```
6872 /// Use instead:
6973 /// ```no_run
70- /// // example code which does not raise clippy warning
74+ /// fn f(p: *mut u32) {
75+ /// unsafe { core::arch::asm!("mov [{p}], 42", p = in(reg) p, options(nostack)); }
76+ /// }
7177 /// ```
7278 #[ clippy:: version = "1.81.0" ]
7379 pub POINTER_IN_NOMEM_ASM_BLOCK ,
7480 suspicious,
75- "default lint description "
81+ "pointer in nomem asm block "
7682}
7783
7884declare_lint_pass ! ( PointerInNomemAsmBlock => [ POINTER_IN_NOMEM_ASM_BLOCK ] ) ;
0 commit comments