fix(es/parser): Allow building with stable rustc (#4024)

This commit is contained in:
Lennart 2022-03-15 11:58:29 +01:00 committed by GitHub
parent b12a2f3ba5
commit 25e5ccc548
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -221,7 +221,7 @@ impl<'a, I: Input> Lexer<'a, I> {
let mut read_any = false; let mut read_any = false;
let res = self.read_digits::<RADIX, _, f64>( let res = self.read_digits::<_, f64, RADIX>(
|total, radix, v| { |total, radix, v| {
read_any = true; read_any = true;
Ok((f64::mul_add(total, radix as f64, v as f64), true)) Ok((f64::mul_add(total, radix as f64, v as f64), true))
@ -255,7 +255,7 @@ impl<'a, I: Input> Lexer<'a, I> {
let mut read_any = false; let mut read_any = false;
let mut raw = Raw(Some(String::new())); let mut raw = Raw(Some(String::new()));
self.read_digits::<RADIX, _, f64>( self.read_digits::<_, f64, RADIX>(
|total, radix, v| { |total, radix, v| {
read_any = true; read_any = true;
@ -306,7 +306,7 @@ impl<'a, I: Input> Lexer<'a, I> {
raw: &mut Raw, raw: &mut Raw,
) -> LexResult<Option<f64>> { ) -> LexResult<Option<f64>> {
let mut count = 0u16; let mut count = 0u16;
let v = self.read_digits::<RADIX, _, Option<f64>>( let v = self.read_digits::<_, Option<f64>, RADIX>(
|opt: Option<f64>, radix, val| { |opt: Option<f64>, radix, val| {
count += 1; count += 1;
let total = opt.unwrap_or_default() * radix as f64 + val as f64; let total = opt.unwrap_or_default() * radix as f64 + val as f64;
@ -331,7 +331,7 @@ impl<'a, I: Input> Lexer<'a, I> {
let start = self.state.start; let start = self.state.start;
let mut count = 0; let mut count = 0;
let v = self.read_digits::<RADIX, _, Option<u32>>( let v = self.read_digits::<_, Option<u32>, RADIX>(
|opt: Option<u32>, radix, val| { |opt: Option<u32>, radix, val| {
count += 1; count += 1;
@ -359,7 +359,7 @@ impl<'a, I: Input> Lexer<'a, I> {
} }
/// `op`- |total, radix, value| -> (total * radix + value, continue) /// `op`- |total, radix, value| -> (total * radix + value, continue)
fn read_digits<const RADIX: u8, F, Ret>( fn read_digits<F, Ret, const RADIX: u8>(
&mut self, &mut self,
mut op: F, mut op: F,
raw: &mut Raw, raw: &mut Raw,