Can you clean the casts while you're at it.
```d
auto p = cast(typeof(s.ptr))memchr(s.ptr, c, s.length);
return p !is null ? p - s.ptr : -1;
```