Skip to content

Clippy string-to-string --fix generates broken code #15300

@szokeasaurusrex

Description

@szokeasaurusrex

Summary

I received the following message after running cargo clippy --fix --workspace after enabling the string-to-string lint.

after fixes were automatically applied the compiler reported errors within these files:

  * src/utils/sourcemaps.rs

This likely indicates a bug in either rustc or cargo itself,
and we would appreciate a bug report! You're likely to see
a number of compiler warnings after this message which cargo
attempted to fix but failed. If you could open an issue at
https://github.com/rust-lang/rust-clippy/issues
quoting the full output of this command we'd be very appreciative!
Note that you may be able to make some more progress in the near-term
fixing code with the `--broken-code` flag

Full logs here.

Reproducer

  1. Clone the Sentry CLI repository.
     gh repo clone getsentry/sentry-cli 
  2. Check out this commit
    git checkout 1886d4a2c62c4536b9b7a1eb2d4cc7a3e655c5cc
  3. Run Clippy with --fix
    cargo clippy --workspace --fix
  4. Observe the error

Version

rustc 1.88.0 (6b00bc388 2025-06-23)
binary: rustc
commit-hash: 6b00bc3880198600130e1cf62b8f8a93494488cc
commit-date: 2025-06-23
host: aarch64-apple-darwin
release: 1.88.0

Additional Labels

No response

Metadata

Metadata

Assignees

Labels

C-bugCategory: Clippy is not doing the correct thing

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions