Skip to content

Allow commenting out error patterns #359

Description

@ada4a

When debugging a Clippy lint, I often find myself adding a bunch of debugprint, and commenting out all the code in a test file other than the part I want to test, to avoid getting flooded by the debug output. But those commented-out parts almost always contain error patterns, and apparently ui_test doesn't like having commented-out error patterns, failing with a message like this:

error: comment looks suspiciously like a test suite command: `~^ clippy::unnecessary_cast`
All `//@` test suite commands must be at the start of the line.
The `//` must be directly followed by `@` or `~`.
 --> tests/ui/aa.rs:3:10
  |
3 |     // //~^ clippy::unnecessary_cast
  |          ^
  |

Being a hard error, this stops the testing completely, which requires me to go and completely remove the lines with error patterns, and restore them through Git afterwards... a bit cumbersome.

I'd see 2 ways to solve this:

  • downgrade this error to a warning
  • recognize commented-out error patterns in particular, and don't warn at them at all

WDYT? I'm willing to implement the solutions presented, but if you have any other ideas, I'd probably be able to implement them as well

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions