Files
swift-nio/Sources
Cory Benfield 1376c7d2d3 Sometimes @escaping is a lie. (#1786)
Motivation:

_contextSync and contextForPredicate0 both accept their closure as
@escaping. _contextSync does so presumably only becuase
contextForPredicate0 does. However, this @escaping directive is
unnecessary: the closure does not escape, and never could.

In general this doesn't matter as these methods are internal, and called
from within the library. However, _contextSync is @usableFromInline, and
is called on several @inlinable call paths, including:

- `ChannelPipeline.handler(type:)`
- `ChannelPipeline.context(handlerType:)`
- `ChannelPipeline.SynchronousOperations.context(handlerType:)`
- `ChannelPipeline.SynchronousOperations.handler(type:)`

All of these presumably allocate more than they need to because there's
an optimisation boundary preventing user code from observing that the
closure does not actually allocate.

Modifications:

Delete `@escaping`.

Result:

Presumably faster code.
2021-03-18 17:14:28 +00:00
..
2021-01-22 18:39:10 +00:00
2021-03-18 17:14:28 +00:00