From 2c31251cb289b685b1a2ef81d9a94cb21728128b Mon Sep 17 00:00:00 2001 From: Dominic Date: Mon, 14 Oct 2019 02:37:50 +0200 Subject: [PATCH] weird proc macro issue --- gotham_restful/src/lib.rs | 3 +++ gotham_restful/src/result.rs | 3 ++- gotham_restful_derive/src/lib.rs | 10 +--------- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/gotham_restful/src/lib.rs b/gotham_restful/src/lib.rs index 594c938..25530e4 100644 --- a/gotham_restful/src/lib.rs +++ b/gotham_restful/src/lib.rs @@ -70,6 +70,9 @@ OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS LICENSE. [serde_json]: https://github.com/serde-rs/json#serde-json---- */ +// weird proc macro issue +extern crate self as gotham_restful; + #[macro_use] extern crate gotham_derive; #[macro_use] extern crate serde; diff --git a/gotham_restful/src/result.rs b/gotham_restful/src/result.rs index 53011fd..86c10be 100644 --- a/gotham_restful/src/result.rs +++ b/gotham_restful/src/result.rs @@ -74,7 +74,7 @@ This can be returned from a resource when there is no cause of an error. For exa ``` # #[macro_use] extern crate gotham_restful_derive; # use gotham::state::State; -# use gotham_restful::Success; +# use gotham_restful::*; # use serde::{Deserialize, Serialize}; # # #[derive(Resource)] @@ -125,6 +125,7 @@ the function attributes: ``` # #[macro_use] extern crate gotham_restful_derive; # use gotham::state::State; +# use gotham_restful::*; # # #[derive(Resource)] # struct MyResource; diff --git a/gotham_restful_derive/src/lib.rs b/gotham_restful_derive/src/lib.rs index 1992aeb..2e15a6e 100644 --- a/gotham_restful_derive/src/lib.rs +++ b/gotham_restful_derive/src/lib.rs @@ -3,7 +3,6 @@ extern crate proc_macro; use proc_macro::TokenStream; use proc_macro2::TokenStream as TokenStream2; use quote::quote; -use std::env; mod method; use method::{expand_method, Method}; @@ -14,14 +13,7 @@ mod openapi_type; fn krate() -> TokenStream2 { - if env::var("CARGO_PKG_NAME").unwrap() == "gotham_restful" - { - quote!(crate) - } - else - { - quote!(::gotham_restful) - } + quote!(::gotham_restful) } #[cfg(feature = "openapi")]