about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/libcore/str.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libcore/str.rs b/src/libcore/str.rs
index 095605326c7..800e2dcc278 100644
--- a/src/libcore/str.rs
+++ b/src/libcore/str.rs
@@ -562,7 +562,7 @@ enum Searcher {
 impl Searcher {
     fn new(haystack: &[u8], needle: &[u8]) -> Searcher {
         // FIXME: Tune this.
-        if needle.len() > haystack.len() - 20 {
+        if needle.len() + 20 > haystack.len() {
             Naive(NaiveSearcher::new())
         } else {
             let searcher = TwoWaySearcher::new(needle);