Update to Rust 2018
This commit is contained in:
		
							parent
							
								
									578c3f38ab
								
							
						
					
					
						commit
						d3322bec11
					
				| @ -9,6 +9,7 @@ name = "ruma-api-macros" | ||||
| readme = "README.md" | ||||
| repository = "https://github.com/ruma/ruma-api-macros" | ||||
| version = "0.3.0" | ||||
| edition = "2018" | ||||
| 
 | ||||
| [dependencies] | ||||
| quote = "0.6.10" | ||||
|  | ||||
| @ -1,5 +1,5 @@ | ||||
| use proc_macro2::{Span, TokenStream}; | ||||
| use quote::{ToTokens, TokenStreamExt}; | ||||
| use quote::{quote, ToTokens, TokenStreamExt}; | ||||
| use syn::{ | ||||
|     braced, | ||||
|     parse::{Parse, ParseStream, Result}, | ||||
| @ -478,7 +478,7 @@ pub struct RawApi { | ||||
| } | ||||
| 
 | ||||
| impl Parse for RawApi { | ||||
|     fn parse(input: ParseStream) -> Result<Self> { | ||||
|     fn parse(input: ParseStream<'_>) -> Result<Self> { | ||||
|         input.parse::<kw::metadata>()?; | ||||
|         let metadata; | ||||
|         braced!(metadata in input); | ||||
|  | ||||
| @ -1,8 +1,8 @@ | ||||
| use proc_macro2::{Span, TokenStream}; | ||||
| use quote::{ToTokens, TokenStreamExt}; | ||||
| use quote::{quote, quote_spanned, ToTokens, TokenStreamExt}; | ||||
| use syn::{spanned::Spanned, Field, Ident, Lit, Meta, NestedMeta}; | ||||
| 
 | ||||
| use api::strip_serde_attrs; | ||||
| use crate::api::strip_serde_attrs; | ||||
| 
 | ||||
| pub struct Request { | ||||
|     fields: Vec<RequestField>, | ||||
| @ -254,7 +254,7 @@ impl ToTokens for Request { | ||||
|         }; | ||||
| 
 | ||||
|         let request_body_struct = if let Some(newtype_body_field) = self.newtype_body_field() { | ||||
|             let mut field = newtype_body_field.clone(); | ||||
|             let field = newtype_body_field.clone(); | ||||
|             let ty = &field.ty; | ||||
|             let span = field.span(); | ||||
| 
 | ||||
|  | ||||
| @ -1,8 +1,8 @@ | ||||
| use proc_macro2::{Span, TokenStream}; | ||||
| use quote::{ToTokens, TokenStreamExt}; | ||||
| use quote::{quote, quote_spanned, ToTokens, TokenStreamExt}; | ||||
| use syn::{spanned::Spanned, Field, Ident, Lit, Meta, NestedMeta}; | ||||
| 
 | ||||
| use api::strip_serde_attrs; | ||||
| use crate::api::strip_serde_attrs; | ||||
| 
 | ||||
| pub struct Response { | ||||
|     fields: Vec<ResponseField>, | ||||
| @ -249,7 +249,7 @@ impl ToTokens for Response { | ||||
|         }; | ||||
| 
 | ||||
|         let response_body_struct = if let Some(newtype_body_field) = self.newtype_body_field() { | ||||
|             let mut field = newtype_body_field.clone(); | ||||
|             let field = newtype_body_field.clone(); | ||||
|             let ty = &field.ty; | ||||
|             let span = field.span(); | ||||
| 
 | ||||
|  | ||||
							
								
								
									
										23
									
								
								src/lib.rs
									
									
									
									
									
								
							
							
						
						
									
										23
									
								
								src/lib.rs
									
									
									
									
									
								
							| @ -7,17 +7,11 @@ | ||||
| #![recursion_limit = "256"] | ||||
| 
 | ||||
| extern crate proc_macro; | ||||
| extern crate proc_macro2; | ||||
| #[macro_use] | ||||
| extern crate quote; | ||||
| extern crate ruma_api; | ||||
| extern crate syn; | ||||
| 
 | ||||
| use proc_macro::TokenStream; | ||||
| 
 | ||||
| use quote::ToTokens; | ||||
| 
 | ||||
| use api::{Api, RawApi}; | ||||
| use crate::api::{Api, RawApi}; | ||||
| 
 | ||||
| mod api; | ||||
| 
 | ||||
| @ -122,22 +116,12 @@ mod api; | ||||
| /// # Examples
 | ||||
| ///
 | ||||
| /// ```rust,no_run
 | ||||
| /// #![feature(proc_macro, try_from)]
 | ||||
| ///
 | ||||
| /// extern crate futures;
 | ||||
| /// extern crate http;
 | ||||
| /// extern crate hyper;
 | ||||
| /// extern crate ruma_api;
 | ||||
| /// extern crate ruma_api_macros;
 | ||||
| /// extern crate serde;
 | ||||
| /// #[macro_use] extern crate serde_derive;
 | ||||
| /// extern crate serde_json;
 | ||||
| /// extern crate serde_urlencoded;
 | ||||
| /// extern crate url;
 | ||||
| /// #![feature(try_from)]
 | ||||
| ///
 | ||||
| /// # fn main() {
 | ||||
| /// pub mod some_endpoint {
 | ||||
| ///     use ruma_api_macros::ruma_api;
 | ||||
| ///     use serde_derive::{Deserialize, Serialize};
 | ||||
| ///
 | ||||
| ///     ruma_api! {
 | ||||
| ///         metadata {
 | ||||
| @ -173,6 +157,7 @@ mod api; | ||||
| ///
 | ||||
| /// pub mod newtype_body_endpoint {
 | ||||
| ///     use ruma_api_macros::ruma_api;
 | ||||
| ///     use serde_derive::{Deserialize, Serialize};
 | ||||
| ///
 | ||||
| ///     #[derive(Clone, Debug, Deserialize, Serialize)]
 | ||||
| ///     pub struct MyCustomType {
 | ||||
|  | ||||
| @ -1,19 +1,8 @@ | ||||
| #![feature(try_from)] | ||||
| 
 | ||||
| extern crate futures; | ||||
| extern crate http; | ||||
| extern crate hyper; | ||||
| extern crate ruma_api; | ||||
| extern crate ruma_api_macros; | ||||
| extern crate serde; | ||||
| #[macro_use] | ||||
| extern crate serde_derive; | ||||
| extern crate serde_json; | ||||
| extern crate serde_urlencoded; | ||||
| extern crate url; | ||||
| 
 | ||||
| pub mod some_endpoint { | ||||
|     use ruma_api_macros::ruma_api; | ||||
|     use serde_derive::{Deserialize, Serialize}; | ||||
| 
 | ||||
|     ruma_api! { | ||||
|         metadata { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user