File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -51,19 +51,19 @@ pub fn graphql_query_derive(input: proc_macro::TokenStream) -> proc_macro::Token
51
51
}
52
52
53
53
fn read_file (
54
- path : impl AsRef < :: std:: path:: Path > + :: std :: fmt :: Debug ,
54
+ path : & :: std:: path:: Path ,
55
55
) -> Result < String , failure:: Error > {
56
56
use std:: io:: prelude:: * ;
57
57
58
58
let mut out = String :: new ( ) ;
59
- let mut file = :: std:: fs:: File :: open ( & path) . map_err ( |io_err| {
59
+ let mut file = :: std:: fs:: File :: open ( path) . map_err ( |io_err| {
60
60
let err: failure:: Error = io_err. into ( ) ;
61
61
err. context ( format ! (
62
62
r#"
63
- Could not find file with path: {:? }
63
+ Could not find file with path: {}
64
64
Hint: file paths in the GraphQLQuery attribute are relative to the project root (location of the Cargo.toml). Example: query_path = "src/my_query.graphql".
65
65
"# ,
66
- path
66
+ path. display ( )
67
67
) )
68
68
} ) ?;
69
69
file. read_to_string ( & mut out) ?;
@@ -88,7 +88,7 @@ fn impl_gql_query(input: &syn::DeriveInput) -> Result<TokenStream, failure::Erro
88
88
. unwrap_or ( deprecation:: DeprecationStrategy :: Warn ) ;
89
89
90
90
// We need to qualify the query with the path to the crate it is part of
91
- let query_path = format ! ( "{}/{}" , cargo_manifest_dir, query_path) ;
91
+ let query_path = :: std :: path :: Path :: new ( & cargo_manifest_dir) . join ( query_path) ;
92
92
let query_string = read_file ( & query_path) ?;
93
93
let query = graphql_parser:: parse_query ( & query_string) ?;
94
94
You can’t perform that action at this time.
0 commit comments