Skip to content

Commit

Permalink
Make std.string.removechars @safe and pure by using implicit conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
tom-tan committed Aug 25, 2013
1 parent 3851d82 commit 927c591
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions std/string.d
Expand Up @@ -2604,8 +2604,10 @@ S removechars(S)(S s, in S pattern) @safe pure if (isSomeString!S)
std.utf.encode(r, c);
}
}
auto trustedAssumeUnique(typeof(r) a)@trusted{ return assumeUnique(a); }
return (changed ? trustedAssumeUnique(r) : s);
if (changed)
return r;
else
return s;
}

unittest
Expand Down

0 comments on commit 927c591

Please sign in to comment.