Skip to content
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

Remove some unnecessary Substrings #87479

Merged
merged 3 commits into from Jun 15, 2023

Conversation

stephentoub
Copy link
Member

No description provided.

@ghost
Copy link

ghost commented Jun 13, 2023

Tagging subscribers to this area: @dotnet/area-meta
See info in area-owners.md if you want to be subscribed.

Issue Details

null

Author: stephentoub
Assignees: stephentoub
Labels:

area-Meta

Milestone: -

@ShreyasJejurkar
Copy link
Contributor

I thought the AsSpan analyzer works on substrings as well, but looks like its only works when used as Range based operator! :(
https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1831

Can't we extend this analyzer to highlight the SubString usage as well!? Thoughts?

@stephentoub
Copy link
Member Author

Can't we extend this analyzer to highlight the SubString usage as well!? Thoughts?

Most of these would be challenging to catch in an analyzer in any time-boxed manner, e.g. where you're calling a method that accepts and returns a string, where the output of that method is fed into one that can take either a substring or a span, where the input to the method is being substring'd, and, critically, where the analyzer can see into the implementation of that called method and determine that both its argument and return value could be changed to spans without changing semantics.

@stephentoub stephentoub merged commit 5a69a5c into dotnet:main Jun 15, 2023
165 of 169 checks passed
@stephentoub stephentoub deleted the removesubstrings branch June 15, 2023 12:41
@dotnet dotnet locked as resolved and limited conversation to collaborators Jul 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants