You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
/// # Panics////// Panics if pattern is empty.pubfnnew(pattern:&'a [C]) -> Self{letmut fail = Vec::with_capacity(pattern.len());
fail.push(0);letmut len = 0;for ch in&pattern[1..]{while len > 0 && pattern[len] != *ch {
len = fail[len - 1];}if pattern[len] == *ch {
len += 1;}
fail.push(len);}Self{ pattern, fail }}
The text was updated successfully, but these errors were encountered:
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.
The text was updated successfully, but these errors were encountered: