mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-09 13:33:43 +00:00
Rollup merge of #21100 - tstorch:small_readability_update, r=alexcrichton
Why not use what is there?
This commit is contained in:
commit
6a5c948a00
@ -678,18 +678,15 @@ struct TwoWaySearcher {
|
|||||||
*/
|
*/
|
||||||
impl TwoWaySearcher {
|
impl TwoWaySearcher {
|
||||||
fn new(needle: &[u8]) -> TwoWaySearcher {
|
fn new(needle: &[u8]) -> TwoWaySearcher {
|
||||||
let (crit_pos1, period1) = TwoWaySearcher::maximal_suffix(needle, false);
|
let (crit_pos_false, period_false) = TwoWaySearcher::maximal_suffix(needle, false);
|
||||||
let (crit_pos2, period2) = TwoWaySearcher::maximal_suffix(needle, true);
|
let (crit_pos_true, period_true) = TwoWaySearcher::maximal_suffix(needle, true);
|
||||||
|
|
||||||
let crit_pos;
|
let (crit_pos, period) =
|
||||||
let period;
|
if crit_pos_false > crit_pos_true {
|
||||||
if crit_pos1 > crit_pos2 {
|
(crit_pos_false, period_false)
|
||||||
crit_pos = crit_pos1;
|
} else {
|
||||||
period = period1;
|
(crit_pos_true, period_true)
|
||||||
} else {
|
};
|
||||||
crit_pos = crit_pos2;
|
|
||||||
period = period2;
|
|
||||||
}
|
|
||||||
|
|
||||||
// This isn't in the original algorithm, as far as I'm aware.
|
// This isn't in the original algorithm, as far as I'm aware.
|
||||||
let byteset = needle.iter()
|
let byteset = needle.iter()
|
||||||
|
Loading…
Reference in New Issue
Block a user