mirror of
https://github.com/Noratrieb/mono-fmt.git
synced 2026-01-14 15:25:08 +01:00
fixes
This commit is contained in:
parent
010126ce0b
commit
8862186a1f
7 changed files with 65 additions and 31 deletions
|
|
@ -5,7 +5,7 @@ use std::cell::Cell;
|
|||
|
||||
use format::Parse as _;
|
||||
use proc_macro::TokenStream;
|
||||
use quote::{ToTokens, quote};
|
||||
use quote::{quote, ToTokens};
|
||||
use syn::{
|
||||
parse::{Parse, ParseStream},
|
||||
parse_macro_input, Expr, ExprAssign, ExprPath, Ident, LitStr, PathArguments, Result, Token,
|
||||
|
|
@ -77,7 +77,9 @@ fn format_args_impl(input: Input) -> syn::Result<TokenStream> {
|
|||
|
||||
let current_position = Cell::new(0);
|
||||
|
||||
Ok(Scoped::new(&input, &fmt_parts, ¤t_position).to_token_stream().into())
|
||||
Ok(Scoped::new(&input, &fmt_parts, ¤t_position)
|
||||
.to_token_stream()
|
||||
.into())
|
||||
}
|
||||
|
||||
#[proc_macro]
|
||||
|
|
|
|||
|
|
@ -5,7 +5,8 @@ use quote::{quote, ToTokens};
|
|||
|
||||
use crate::{
|
||||
format::{
|
||||
Align, Count, Format, FormatArg, FormatArgRef, FormatTrait, FormatterArgs, Piece, Sign,
|
||||
Align, Count, DebugHex, Format, FormatArg, FormatArgRef, FormatTrait, FormatterArgs, Piece,
|
||||
Sign,
|
||||
},
|
||||
Input,
|
||||
};
|
||||
|
|
@ -148,6 +149,14 @@ fn opt_value_tokens(scope: Scoped<'_, FormatterArgs<'_>>) -> TokenStream {
|
|||
opts = quote! { #prefix::WithSignAwareZeroPad(#opts) };
|
||||
}
|
||||
|
||||
if let Some(DebugHex::Lower) = args.debug_hex {
|
||||
opts = quote! { #prefix::WithDebugLowerHex(#opts) };
|
||||
}
|
||||
|
||||
if let Some(DebugHex::Upper) = args.debug_hex {
|
||||
opts = quote! { #prefix::WithDebugUpperHex(#opts) };
|
||||
}
|
||||
|
||||
opts
|
||||
}
|
||||
|
||||
|
|
@ -197,6 +206,14 @@ fn opt_ty_tokens(scope: Scoped<'_, FormatterArgs<'_>>) -> TokenStream {
|
|||
opts = quote! { #prefix::WithSignAwareZeroPad<#opts> };
|
||||
}
|
||||
|
||||
if let Some(DebugHex::Lower) = args.debug_hex {
|
||||
opts = quote! { #prefix::WithDebugLowerHex<#opts> };
|
||||
}
|
||||
|
||||
if let Some(DebugHex::Upper) = args.debug_hex {
|
||||
opts = quote! { #prefix::WithDebugUpperHex<#opts> };
|
||||
}
|
||||
|
||||
opts
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue