]> git.lizzy.rs Git - rust.git/commitdiff
fix tests
authorAriel Ben-Yehuda <ariel.byd@gmail.com>
Mon, 6 Jun 2016 21:07:24 +0000 (00:07 +0300)
committerAriel Ben-Yehuda <ariel.byd@gmail.com>
Wed, 8 Jun 2016 21:38:38 +0000 (00:38 +0300)
src/doc/book/slice-patterns.md

index de165b70fc4028d5846fa4bc8384bc21dea0d966..fcedf0c994f9c6e0e98be4ee689ce8a71ec0e4f7 100644 (file)
@@ -10,7 +10,7 @@ fn main() {
     let v = vec!["match_this", "1"];
 
     match &v[..] {
-        ["match_this", second] => println!("The second element is {}", second),
+        &["match_this", second] => println!("The second element is {}", second),
         _ => {},
     }
 }
@@ -26,8 +26,8 @@ slice will be bound to that name. For example:
 
 fn is_symmetric(list: &[u32]) -> bool {
     match list {
-        [] | [_] => true,
-        [x, inside.., y] if x == y => is_symmetric(inside),
+        &[] | &[_] => true,
+        &[x, ref inside.., y] if x == y => is_symmetric(inside),
         _ => false
     }
 }