From ce8e6455376278067f1a79ff88e0ff8f9c0d34a5 Mon Sep 17 00:00:00 2001 From: topecongiro Date: Thu, 5 Oct 2017 20:50:50 +0900 Subject: [PATCH] Update Contributing.md --- Contributing.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Contributing.md b/Contributing.md index 730cefdca45..3b6bf50adc1 100644 --- a/Contributing.md +++ b/Contributing.md @@ -184,13 +184,13 @@ places) is for the caller to shuffle around some of its other items to make more width, then call the function again with more space. Since it is common for callers to bail out when a callee fails, we often use a -`try_opt!` macro to make this pattern more succinct. +`?` operator to make this pattern more succinct. One way we might find out that we don't have enough space is when computing how much space we have. Something like `available_space = budget - overhead`. Since widths are unsized integers, this would cause underflow. Therefore we use -checked subtraction: `available_space = try_opt!(budget.checked_sub(overhead))`. -`checked_sub` returns an `Option`, and if we would underflow `try_opt!` returns +checked subtraction: `available_space = budget.checked_sub(overhead)?`. +`checked_sub` returns an `Option`, and if we would underflow `?` returns `None`, otherwise we proceed with the computed space. Much syntax in Rust is lists: lists of arguments, lists of fields, lists of