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