Issue 13000 - Casts should be removed to utilize features of inout

https://issues.dlang.org/show_bug.cgi?id=13000

Apply `inout` on function return type.