Open YichiZhang0613 opened 6 months ago
I believe it panics on &pattern[1..]
, doesn't it?
I believe it panics on
&pattern[1..]
, doesn't it?
If pattern is empty as your documentation read then the code would panic. So I think the code should check whether pattern is empty before it is used.
I noticed a possible inconsistency between documentation and code implementation in rust-algorithms/src/string_proc.rs. The details can be found in the following code. The code does not check whether pattern is not empty before it is used but the constraint exists in the documentation.