Change large_futures such that it applies to all expressions of type Future #16349
+361
−76
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.
changelog: [large_futures]: changed lint such that it applies to all expressions of type Future.
Currently large_futures is only applicable to expressions on
awaits that are a call to a function of which the type is larger than a given threshold.This means that the lint does not apply if in the code
awaitis never called on the future. Examples of this include runningblock_onor similar functions, or if the future is passed to an executor. Also it is possible to create futures that are not explicit functions, likeasync {}blocks, or types thatimpl Futuredirectly.This PR attempts to make this lint applicable to all expressions of the type Future. It will try to find the 'deepest' expression in a branch of the expression tree for which this holds, and does not emit a message for any shallower elements in that branch.
Note that this PR currently fails testing as the UI toolkit seems to be very confused about the emitted spans. Multiple messages seem to be emitted for the same span, and the diagnostics do not seem to match at all. Any help concerning this is very appreciated. Example:
Relevant code: