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
5151}
5252
5353fn read_file (
54- path : impl AsRef < :: std:: path:: Path > + :: std :: fmt :: Debug ,
54+ path : & :: std:: path:: Path ,
5555) -> Result < String , failure:: Error > {
5656 use std:: io:: prelude:: * ;
5757
5858 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| {
6060 let err: failure:: Error = io_err. into ( ) ;
6161 err. context ( format ! (
6262 r#"
63- Could not find file with path: {:? }
63+ Could not find file with path: {}
6464 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".
6565 "# ,
66- path
66+ path. display ( )
6767 ) )
6868 } ) ?;
6969 file. read_to_string ( & mut out) ?;
@@ -88,7 +88,7 @@ fn impl_gql_query(input: &syn::DeriveInput) -> Result<TokenStream, failure::Erro
8888 . unwrap_or ( deprecation:: DeprecationStrategy :: Warn ) ;
8989
9090 // 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) ;
9292 let query_string = read_file ( & query_path) ?;
9393 let query = graphql_parser:: parse_query ( & query_string) ?;
9494
You can’t perform that action at this time.
0 commit comments