KEMBAR78
Remove some unnecessary Substrings by stephentoub · Pull Request #87479 · dotnet/runtime · GitHub
Skip to content

Conversation

@stephentoub
Copy link
Member

No description provided.

@ghost ghost added the area-Meta label Jun 13, 2023
@ghost ghost assigned stephentoub Jun 13, 2023
@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
@stephentoub stephentoub deleted the removesubstrings branch June 15, 2023 12:41
@ghost ghost 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.

4 participants