Skip to content

proc macro results in clippy treating a method starting with "r" as a raw string #15273

@Byter09

Description

@Byter09

Summary

While upgrading to Rust 1.88.0 I tried using cargo clippy --fix, and suddenly couldn't compile anymore due to the issue described down below.

I sadly do not have the time to write a fully compiling minimal example (sorry 🥲), but I can provide the snippet.

The macro in question here comes from tracing_attributes version 0.1.26.

Lint Name

needless_raw_strings

Reproducer

I tried this code:

impl MyType {
    #[instrument(name = "run_event_machine", skip(self))]
    fn run(&mut self) {
    ...

I saw this happen:

error: unnecessary raw string literal
   --> src/queries/events/event_machine.rs:166:8
    |
166 |     fn run(&mut self) {
    |        ^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_raw_strings
    = note: `-D clippy::needless-raw-strings` implied by `-D clippy::restriction`
    = help: to override `-D clippy::restriction` add `#[allow(clippy::needless_raw_strings)]`
help: use a plain string literal instead
    |
166 -     fn run(&mut self) {
166 +     fn un(&mut self) {
    |

I expected to see this happen:
Nothing. This is a method.

Version

rustc 1.88.0 (6b00bc388 2025-06-23)
binary: rustc
commit-hash: 6b00bc3880198600130e1cf62b8f8a93494488cc
commit-date: 2025-06-23
host: x86_64-unknown-linux-gnu
release: 1.88.0
LLVM version: 20.1.5

Additional Labels

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveL-restrictionLint: Belongs in the restriction lint group

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions