From 120e98c3c7d28b1667576d0fa32fa94751968699 Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Mon, 30 Dec 2019 01:53:22 +0100 Subject: [PATCH] slice_patterns: remove from unstable book --- .../src/language-features/slice-patterns.md | 32 ------------------- 1 file changed, 32 deletions(-) delete mode 100644 src/doc/unstable-book/src/language-features/slice-patterns.md diff --git a/src/doc/unstable-book/src/language-features/slice-patterns.md b/src/doc/unstable-book/src/language-features/slice-patterns.md deleted file mode 100644 index cdb74495884a8..0000000000000 --- a/src/doc/unstable-book/src/language-features/slice-patterns.md +++ /dev/null @@ -1,32 +0,0 @@ -# `slice_patterns` - -The tracking issue for this feature is: [#62254] - -[#62254]: https://github.com/rust-lang/rust/issues/62254 - ------------------------- - -The `slice_patterns` feature gate lets you use `..` to indicate any number of -elements inside a pattern matching a slice. This wildcard can only be used once -for a given array. If there's an pattern before the `..`, the subslice will be -matched against that pattern. For example: - -```rust -#![feature(slice_patterns)] - -fn is_symmetric(list: &[u32]) -> bool { - match list { - &[] | &[_] => true, - &[x, ref inside @ .., y] if x == y => is_symmetric(inside), - &[..] => false, - } -} - -fn main() { - let sym = &[0, 1, 4, 2, 4, 1, 0]; - assert!(is_symmetric(sym)); - - let not_sym = &[0, 1, 7, 2, 4, 1, 0]; - assert!(!is_symmetric(not_sym)); -} -```