Skip to content

Commit 9913d7b

Browse files
authored
Merge pull request #1408 from jameslahm/master
doc(testcase_linked_list): add a little extra note about pattern
2 parents 8f6b7a6 + aa04f92 commit 9913d7b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/custom_types/enum/testcase_linked_list.md

+3
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ impl List {
3232
// depends on the variant of `self`
3333
// `self` has type `&List`, and `*self` has type `List`, matching on a
3434
// concrete type `T` is preferred over a match on a reference `&T`
35+
// after Rust 2018 you can use self here and tail (with no ref) below as well,
36+
// rust will infer &s and ref tail.
37+
// See https://doc.rust-lang.org/edition-guide/rust-2018/ownership-and-lifetimes/default-match-bindings.html
3538
match *self {
3639
// Can't take ownership of the tail, because `self` is borrowed;
3740
// instead take a reference to the tail

0 commit comments

Comments
 (0)