-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Suggest str methods for trivial regexes #596
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
As with the regex validation lint, the trick is using |
Also note that the following holds:
|
We could add suggestions taking the original str (beware of backslashes, though). |
Speaking of backslashes, I found the following false negative:
|
@llogiq I made a PR to fix that false negative. What kind of suggestion do you propose? |
This would require using an ExprUseVisitor to find all usages of the regex and suggest using |
It lints against features that are inteded to be internal to the compiler and standard library. Implements MCP rust-lang#596. We allow `internal_features` in the standard library and compiler as those use many features and this _is_ the standard library from the "internal to the compiler and standard library" after all. Marking some features as internal wasn't exactly the most scientific approach, I just marked some mostly obvious features. While there is a categorization in the macro, it's not very well upheld (should probably be fixed in another PR). We always pass `-Ainternal_features` in the testsuite About 400 UI tests and several other tests use internal features. Instead of throwing the attribute on each one, just always allow them. There's nothing wrong with testing internal features^^
The
contains
and{starts,ends}_with
methods ofstr
can solve many simple regex cases.cf. #587
The text was updated successfully, but these errors were encountered: