From 4f9fe856a25ab29345b90e7725509e9ee38a37be Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:41 +0200 Subject: Adding upstream version 1.69.0+dfsg1. Signed-off-by: Daniel Baumann --- vendor/time-macros/src/to_tokens.rs | 68 ------------------------------------- 1 file changed, 68 deletions(-) delete mode 100644 vendor/time-macros/src/to_tokens.rs (limited to 'vendor/time-macros/src/to_tokens.rs') diff --git a/vendor/time-macros/src/to_tokens.rs b/vendor/time-macros/src/to_tokens.rs deleted file mode 100644 index 3a293925c..000000000 --- a/vendor/time-macros/src/to_tokens.rs +++ /dev/null @@ -1,68 +0,0 @@ -use proc_macro::{Group, Ident, Literal, Punct, Span, TokenStream, TokenTree}; - -pub(crate) trait ToTokenStream: Sized { - fn append_to(self, ts: &mut TokenStream); -} - -pub(crate) trait ToTokenTree: Sized { - fn into_token_tree(self) -> TokenTree; -} - -impl ToTokenStream for T { - fn append_to(self, ts: &mut TokenStream) { - ts.extend([self.into_token_tree()]) - } -} - -impl ToTokenTree for bool { - fn into_token_tree(self) -> TokenTree { - let lit = if self { "true" } else { "false" }; - TokenTree::Ident(Ident::new(lit, Span::mixed_site())) - } -} - -impl ToTokenStream for TokenStream { - fn append_to(self, ts: &mut TokenStream) { - ts.extend(self) - } -} - -impl ToTokenTree for TokenTree { - fn into_token_tree(self) -> TokenTree { - self - } -} - -impl ToTokenTree for &str { - fn into_token_tree(self) -> TokenTree { - TokenTree::Literal(Literal::string(self)) - } -} - -macro_rules! impl_for_tree_types { - ($($type:ty)*) => {$( - impl ToTokenTree for $type { - fn into_token_tree(self) -> TokenTree { - TokenTree::from(self) - } - } - )*}; -} -impl_for_tree_types![Ident Literal Group Punct]; - -macro_rules! impl_for_int { - ($($type:ty => $method:ident)*) => {$( - impl ToTokenTree for $type { - fn into_token_tree(self) -> TokenTree { - TokenTree::from(Literal::$method(self)) - } - } - )*}; -} -impl_for_int! { - i8 => i8_unsuffixed - u8 => u8_unsuffixed - u16 => u16_unsuffixed - i32 => i32_unsuffixed - u32 => u32_unsuffixed -} -- cgit v1.2.3