From 2a76343d66d99be6a162765b8db6991467b889cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20J=C3=B6rdens?= Date: Thu, 13 Jan 2022 10:43:36 +0100 Subject: [PATCH 1/2] no_std: add attribute to crate This actually allows this crate to be used in no_std contexts. --- src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib.rs b/src/lib.rs index aef86be..8e8fa74 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -43,6 +43,7 @@ clippy::module_name_repetitions, clippy::cargo_common_metadata )] +#![cfg_attr(not(feature = "std"), no_std)] use core::fmt::{self, Display}; From 98e5781ab2e24d2ad40065e4063bccd06cc68470 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20J=C3=B6rdens?= Date: Thu, 13 Jan 2022 10:59:34 +0100 Subject: [PATCH 2/2] run cargo fmt --all --- extras/simple-bench/src/main.rs | 2 +- src/number.rs | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/extras/simple-bench/src/main.rs b/extras/simple-bench/src/main.rs index 9428fad..c308b23 100644 --- a/extras/simple-bench/src/main.rs +++ b/extras/simple-bench/src/main.rs @@ -276,7 +276,7 @@ impl Input { fn main() { let opt: Opt = StructOpt::from_args(); - let methods = if !opt.only_fast_float && !matches!(&opt.command, &Cmd::All {..}) { + let methods = if !opt.only_fast_float && !matches!(&opt.command, &Cmd::All { .. }) { Method::all().into() } else { vec![Method::FastFloat] diff --git a/src/number.rs b/src/number.rs index b3d95f5..785281c 100644 --- a/src/number.rs +++ b/src/number.rs @@ -102,15 +102,11 @@ fn try_parse_8digits(s: &mut AsciiStr<'_>, x: &mut u64) { // may cause overflows, to be handled later if let Some(v) = s.try_read_u64() { if is_8digits(v) { - *x = x - .wrapping_mul(1_0000_0000) - .wrapping_add(parse_8digits(v)); + *x = x.wrapping_mul(1_0000_0000).wrapping_add(parse_8digits(v)); s.step_by(8); if let Some(v) = s.try_read_u64() { if is_8digits(v) { - *x = x - .wrapping_mul(1_0000_0000) - .wrapping_add(parse_8digits(v)); + *x = x.wrapping_mul(1_0000_0000).wrapping_add(parse_8digits(v)); s.step_by(8); } }