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
The documentation should document how [] changes inside a match as opposed to outside of one. A quick browsing of the guides didn't find this noted anywhere:
fnmain(){let array = ["a","b"];// `[]` denotes `array`let v = vec!["match_this","1"];match v {// ^ Change `v` to `v.as_slice()` to make this work. Hard to discover...// How does this work though? It appears like this is matching a slice// against an array and succeeding. It is not obvious that `[]` inside a// match is `slice` syntax and not `array` syntax// Now `[]` denotes slice...["match_this", a] => println!("{}", a),
_ => {},}}
The text was updated successfully, but these errors were encountered:
The documentation should document how
[]
changes inside a match as opposed to outside of one. A quick browsing of the guides didn't find this noted anywhere:The text was updated successfully, but these errors were encountered: