Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Geal committed Aug 21, 2021
1 parent fb711cf commit e2d82ee
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 14 deletions.
20 changes: 12 additions & 8 deletions src/number/complete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1445,13 +1445,17 @@ where

//let (i, zeroes) = take_while(|c: <T as InputTakeAtPosition>::Item| c.as_char() == '0')(i)?;
let (i, zeroes) = match i.as_bytes().iter().position(|c| *c != b'0' as u8) {
Some(index) => i.take_split(index),
None => i.take_split(i.input_len()),
Some(index) => i.take_split(index),
None => i.take_split(i.input_len()),
};
//let (i, mut integer) = digit0(i)?;
let (i, mut integer) = match i.as_bytes().iter().position(|c| !(*c >= b'0' as u8 && *c <= b'9' as u8)) {
Some(index) => i.take_split(index),
None => i.take_split(i.input_len()),
let (i, mut integer) = match i
.as_bytes()
.iter()
.position(|c| !(*c >= b'0' as u8 && *c <= b'9' as u8))
{
Some(index) => i.take_split(index),
None => i.take_split(i.input_len()),
};

if integer.input_len() == 0 && zeroes.input_len() > 0 {
Expand Down Expand Up @@ -1499,9 +1503,9 @@ where

let i2 = i.clone();
let (i, e) = match i.as_bytes().iter().next() {
Some(b'e') => (i.slice(1..), true),
Some(b'E') => (i.slice(1..), true),
_ => (i, false),
Some(b'e') => (i.slice(1..), true),
Some(b'E') => (i.slice(1..), true),
_ => (i, false),
};

let (i, exp) = if e {
Expand Down
16 changes: 10 additions & 6 deletions src/number/streaming.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1419,7 +1419,11 @@ where
};

//let (i, mut integer) = digit0(i)?;
let (i, mut integer) = match i.as_bytes().iter().position(|c| !(*c >= b'0' as u8 && *c <= b'9' as u8)) {
let (i, mut integer) = match i
.as_bytes()
.iter()
.position(|c| !(*c >= b'0' as u8 && *c <= b'9' as u8))
{
Some(index) => i.take_split(index),
None => i.take_split(i.input_len()),
};
Expand All @@ -1438,8 +1442,8 @@ where
let mut zero_count = 0usize;
let mut position = None;
for (pos, c) in i.as_bytes().iter().enumerate() {
if *c >= b'0' as u8 && *c <= b'9' as u8 {
if *c == b'0' as u8 {
if *c >= b'0' as u8 && *c <= b'9' as u8 {
if *c == b'0' as u8 {
zero_count += 1;
} else {
zero_count = 0;
Expand Down Expand Up @@ -1472,9 +1476,9 @@ where

let i2 = i.clone();
let (i, e) = match i.as_bytes().iter().next() {
Some(b'e') => (i.slice(1..), true),
Some(b'E') => (i.slice(1..), true),
_ => (i, false),
Some(b'e') => (i.slice(1..), true),
Some(b'E') => (i.slice(1..), true),
_ => (i, false),
};

let (i, exp) = if e {
Expand Down

0 comments on commit e2d82ee

Please sign in to comment.