use rustc_ast::ast::{Lit, LitFloatType, LitIntType, LitKind};
+use std::iter;
#[derive(Debug, PartialEq, Copy, Clone)]
pub enum Radix {
pub fn from_lit_kind(src: &'a str, lit_kind: &LitKind) -> Option<NumericLiteral<'a>> {
if lit_kind.is_numeric() && src.chars().next().map_or(false, |c| c.is_digit(10)) {
- let (unsuffixed, suffix) = split_suffix(&src, lit_kind);
+ let (unsuffixed, suffix) = split_suffix(src, lit_kind);
let float = matches!(lit_kind, LitKind::Float(..));
Some(NumericLiteral::new(unsuffixed, suffix, float))
} else {
}
if let Some(suffix) = self.suffix {
+ if output.ends_with('.') {
+ output.push('0');
+ }
output.push('_');
output.push_str(suffix);
}
}
}
- for (c, i) in digits.zip((0..group_size).cycle()) {
+ for (c, i) in iter::zip(digits, (0..group_size).cycle()) {
if i == 0 {
output.push('_');
}