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
// end is a slice of everything but the first element, which must be "a"
90
+
//`end` is a slice of everything but the first element, which must be "a".
91
91
["a", end@..] =>println!("ends with: {:?}", end),
92
92
93
93
rest=>println!("{:?}", rest),
@@ -103,17 +103,17 @@ If you're interested in learning more, we published [a post on the Inside Rust b
103
103
This release of Rust stabilizes a new macro, [`matches!`](https://doc.rust-lang.org/nightly/std/macro.matches.html). This macro accepts an expression and a pattern, and returns true if the pattern matches the expression. In other words:
104
104
105
105
```rust
106
-
//with the match keyword
106
+
//Using a match expression:
107
107
matchself.partial_cmp(other) {
108
108
Some(Less) =>true,
109
109
_=>false,
110
110
}
111
111
112
-
//with the matches! macro
112
+
//Using the `matches!` macro:
113
113
matches!(self.partial_cmp(other), Some(Less))
114
114
```
115
115
116
-
You can also use features like `|` patterns and `if`clauses:
116
+
You can also use features like `|` patterns and `if`guards:
117
117
118
118
```rust
119
119
letfoo='f';
@@ -127,7 +127,7 @@ assert!(matches!(bar, Some(x) if x > 2));
127
127
128
128
In Rust 2018, we [removed the need for `extern crate`](https://doc.rust-lang.org/stable/edition-guide/rust-2018/module-system/path-clarity.html#no-more-extern-crate). But procedural macros were a bit special, and so when you were writing a procedural macro, you still needed to say `extern crate proc_macro;`.
129
129
130
-
In this release, [you no longer need this line when working with the 2018 edition; you can use `use` like any other crate][cargo/7700]. Given that most projects will already have a line similar to `use proc_macro::TokenStream;`, this change will mean that you can delete the `extern crate proc_macro;` line and your code will still work. This change is small, but brings procedural macros closer to regular code.
130
+
In this release, if you are using Cargo, [you no longer need this line when working with the 2018 edition; you can use `use` like any other crate][cargo/7700]. Given that most projects will already have a line similar to `use proc_macro::TokenStream;`, this change will mean that you can delete the `extern crate proc_macro;` line and your code will still work. This change is small, but brings procedural macros closer to regular code.
131
131
132
132
### Libraries
133
133
@@ -172,4 +172,4 @@ Apple is no longer supporting 32-bit targets, and so, neither are we. They have
172
172
173
173
## Contributors to 1.42.0
174
174
175
-
Many people came together to create Rust 1.42.0. We couldn't have done it without all of you. [Thanks!](https://thanks.rust-lang.org/rust/1.42.0/)
175
+
Many people came together to create Rust 1.42.0. We couldn't have done it without all of you. [Thanks!](https://thanks.rust-lang.org/rust/1.42.0/)
0 commit comments