I've noticed doing some benches that this idiom prevents inlining with dmd, which *really* kills performance for these kinds of tiny functions. Having a named function instead of a lambda bypasses the problem.

Could you change it to something like:

```D
auto trustedmemchr() @trusted{ return memchr(s.ptr, c, s.length); }
auto p = trustedmemchr();
```