From bc6dc24a6301f5a82d9ba56c02b445e8804ec215 Mon Sep 17 00:00:00 2001 From: omahs <73983677+omahs@users.noreply.github.com> Date: Mon, 23 Jan 2023 10:54:31 +0100 Subject: [PATCH] Fix: typos Fix: typos --- documentation/coding_guidelines.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/documentation/coding_guidelines.md b/documentation/coding_guidelines.md index 9a929e3614..48bda149ab 100644 --- a/documentation/coding_guidelines.md +++ b/documentation/coding_guidelines.md @@ -129,7 +129,7 @@ A good example of README.md is `diem/network/README.md` that describes the netwo ## Binary, Argument, and Crate Naming -Most tools that we use everyday (rustc, cargo, git, rg, etc.) use dashes `-` as +Most tools that we use every day (rustc, cargo, git, rg, etc.) use dashes `-` as a separator for binary names and arguments and the [GNU software manual](https://www.gnu.org/software/libc/manual/html_node/Argument-Syntax.html) dictates that long options should "consist of `--` followed by a name made of @@ -231,11 +231,11 @@ impl Foo { As every integer operation (`+`, `-`, `/`, `*`, etc.) implies edge-cases (e.g. overflows `u64::MAX + 1`, underflows `0u64 -1`, division by zero, etc.), we use checked arithmetic instead of directly using math symbols. -It forces us to think of edge-cases, and handle them explicitely. +It forces us to think of edge-cases, and handle them explicitly. This is a brief and simplified mini guide of the different functions that exist to handle integer arithmetic: * [checked_](https://doc.rust-lang.org/std/primitive.u32.html#method.checked_add): use this function if you want to handle overflows and underflows as a special edge-case. It returns `None` if an underflow or overflow has happened, and `Some(operation_result)` otherwise. -* [overflowing_](https://doc.rust-lang.org/std/primitive.u32.html#method.overflowing_add): use this function if you want the result of an overflow to potentially wrap around (e.g. `u64::MAX.overflow_add(10) == (9, true)`). It returns the underflowed or overflowed result as well as a flag indicating if an overflow has occured or not. +* [overflowing_](https://doc.rust-lang.org/std/primitive.u32.html#method.overflowing_add): use this function if you want the result of an overflow to potentially wrap around (e.g. `u64::MAX.overflow_add(10) == (9, true)`). It returns the underflowed or overflowed result as well as a flag indicating if an overflow has occurred or not. * [wrapping_](https://doc.rust-lang.org/std/primitive.u32.html#method.wrapping_add): this is similar to overflowing operations, except that it returns the result directly. Use this function if you are sure that you want to handle underflows and overflows by wrapping around. * [saturating_](https://doc.rust-lang.org/std/primitive.u32.html#method.saturating_add): if an overflow occurs, the result is kept within the boundary of the type (e.g. `u64::MAX.saturating_add(1) == u64::MAX`).