From b4674bce5b557136eb419ade3b385080ea4bcd11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B8=BF=E7=AB=A0?= Date: Thu, 10 Oct 2019 15:10:09 +0800 Subject: [PATCH 1/3] `...` range patterns are deprecated --- src/flow_control/match/binding.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/flow_control/match/binding.md b/src/flow_control/match/binding.md index e1aa232169..0407b37774 100644 --- a/src/flow_control/match/binding.md +++ b/src/flow_control/match/binding.md @@ -15,9 +15,9 @@ fn main() { match age() { 0 => println!("I'm not born yet I guess"), - // Could `match` 1 ... 12 directly but then what age + // Could `match` 1 ..= 12 directly but then what age // would the child be? Instead, bind to `n` for the - // sequence of 1 .. 12. Now the age can be reported. + // sequence of 1 ..= 12. Now the age can be reported. n @ 1 ..= 12 => println!("I'm a child of age {:?}", n), n @ 13 ..= 19 => println!("I'm a teen of age {:?}", n), // Nothing bound. Return the result. From 24affdcec037a7544aadae21d4463f06671b9901 Mon Sep 17 00:00:00 2001 From: ngolin Date: Fri, 11 Oct 2019 23:20:13 +0800 Subject: [PATCH 2/3] Change misleading `ident` to `expr` If marked as `ident`, `$a.len()` and `$b.len()` are confusing. Actually, `xs` and `ys` are expressions, too. --- src/macros/dry.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/macros/dry.md b/src/macros/dry.md index 7333d0e812..ca015272af 100644 --- a/src/macros/dry.md +++ b/src/macros/dry.md @@ -10,7 +10,7 @@ use std::ops::{Add, Mul, Sub}; macro_rules! assert_equal_len { // The `tt` (token tree) designator is used for // operators and tokens. - ($a:ident, $b:ident, $func:ident, $op:tt) => { + ($a:expr, $b:expr, $func:ident, $op:tt) => { assert!($a.len() == $b.len(), "{:?}: dimension mismatch: {:?} {:?} {:?}", stringify!($func), From b9b785e71448296784bd98481ffd7ba2d35d93e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B8=BF=E7=AB=A0?= Date: Sat, 12 Oct 2019 14:41:22 +0800 Subject: [PATCH 3/3] No `Ok` or `Err`, just `Ok(T)` and `Err(E)` --- src/error/result.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/error/result.md b/src/error/result.md index 3202b314ea..d779bfdad1 100644 --- a/src/error/result.md +++ b/src/error/result.md @@ -5,8 +5,8 @@ describes possible *error* instead of possible *absence*. That is, `Result` could have one of two outcomes: -* `Ok`: An element `T` was found -* `Err`: An error was found with element `E` +* `Ok(T)`: An element `T` was found +* `Err(E)`: An error was found with element `E` By convention, the expected outcome is `Ok` while the unexpected outcome is `Err`.