Support clippy::needless_raw_strings lint#828
Merged
max-sixty merged 8 commits intomitsuhiko:masterfrom Dec 15, 2025
Merged
Conversation
[to be written by @max-sixty] 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This test uses raw string literals as test inputs to verify normalization behavior with different string formats. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
max-sixty
commented
Nov 24, 2025
| @@ -1,4 +1,5 @@ | |||
| #![warn(clippy::doc_markdown)] | |||
| #![warn(clippy::needless_raw_strings)] | |||
Collaborator
Author
There was a problem hiding this comment.
this isn't strictly necessary, I used this to test our approach was working. can remove at any light objection
max-sixty
commented
Nov 24, 2025
| if !has_control_chars && contents.contains(['\\', '"', '\n']) { | ||
| // We don't use raw strings just for newlines, as they can appear | ||
| // literally in regular strings (avoids clippy::needless_raw_strings). | ||
| if !has_control_chars && contents.contains(['\\', '"']) { |
Collaborator
Author
There was a problem hiding this comment.
these are the substantive changes
Tests test_min_indentation and test_min_indentation_additional use raw strings as test inputs to verify indentation handling behavior. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Add allow attributes to test_parse_yaml_error and test_empty_lines which use raw strings as test input values. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add new functional tests specifically for testing needless raw string handling (both as inputs and outputs) - Remove #[allow(clippy::needless_raw_strings)] attributes from unit tests - Convert needless raw strings in unit tests to regular strings - Keep raw strings only where they're actually needed (contain quotes or backslashes) This separates concerns: functional tests explicitly verify raw string handling behavior, while unit tests focus on testing internal logic without using needless raw strings. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Accept the correct diff output format for the functional tests. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Collaborator
Author
|
will merge, but would be backward compat with existing snapshots if @mitsuhiko had strong reservations post |
gaetschwartz
added a commit
to gaetschwartz/insta
that referenced
this pull request
Dec 16, 2025
Revert accidental regression from ad13147 that added '\n' to the raw string condition. Multiline content should not use raw string prefixes unless it contains backslashes or quotes, matching upstream/master behavior from PR mitsuhiko#828.
max-sixty
added a commit
that referenced
this pull request
Dec 18, 2025
## Summary - Add external diff tool support via `INSTA_DIFF_TOOL` environment variable (#844) - Add `test.disable_nextest_doctest` config option to `insta.yaml` (#842) - Skip non-insta snapshot files in unreferenced detection (#846) - Collect warnings from tests for display after run (#840) - Update TOML serialization to be up-to-date and backwards-compatible (#834) - Support `clippy::needless_raw_strings` lint (#828) ## Test plan - [x] All tests pass - [x] All lints pass 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <noreply@anthropic.com>
gaetschwartz
added a commit
to gaetschwartz/insta
that referenced
this pull request
Feb 3, 2026
Revert accidental regression from ad13147 that added '\n' to the raw string condition. Multiline content should not use raw string prefixes unless it contains backslashes or quotes, matching upstream/master behavior from PR mitsuhiko#828.
gaetschwartz
added a commit
to gaetschwartz/insta
that referenced
this pull request
Feb 26, 2026
Revert accidental regression from ad13147 that added '\n' to the raw string condition. Multiline content should not use raw string prefixes unless it contains backslashes or quotes, matching upstream/master behavior from PR mitsuhiko#828.
gaetschwartz
added a commit
to gaetschwartz/insta
that referenced
this pull request
Feb 28, 2026
Revert accidental regression from ad13147 that added '\n' to the raw string condition. Multiline content should not use raw string prefixes unless it contains backslashes or quotes, matching upstream/master behavior from PR mitsuhiko#828.
gaetschwartz
added a commit
to gaetschwartz/insta
that referenced
this pull request
Mar 14, 2026
Revert accidental regression from ad13147 that added '\n' to the raw string condition. Multiline content should not use raw string prefixes unless it contains backslashes or quotes, matching upstream/master behavior from PR mitsuhiko#828.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
this would fix #827
@mitsuhiko do you have thoughts? I'm mildly positive on it but will leave it open for a while because I think you voiced weak skepticism in the past.
Claude comment below
Changes
to_inline()to only use raw strings when content contains backslashes or quotesclippy::needless_raw_stringslint to the projectTest Results
✅ All tests pass
✅ Zero clippy warnings in production code
✅ 44+ needless raw strings converted to regular strings
🤖 Generated with Claude Code