File tree Expand file tree Collapse file tree 3 files changed +6
-12
lines changed Expand file tree Collapse file tree 3 files changed +6
-12
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ repository = "https://github.com/graphql-rust/graphql-client"
88
99[dependencies ]
1010failure = " 0.1"
11+ itertools = " 0.8"
1112lazy_static = " 1.0"
1213quote = " 0.6"
1314syn = " 0.15.20"
Original file line number Diff line number Diff line change 99extern crate failure;
1010extern crate graphql_parser;
1111extern crate heck;
12+ extern crate itertools;
1213#[ macro_use]
1314extern crate lazy_static;
1415extern crate proc_macro;
Original file line number Diff line number Diff line change @@ -5,18 +5,10 @@ use objects::GqlObjectField;
55use proc_macro2:: { Ident , Span , TokenStream } ;
66use query:: QueryContext ;
77use selection:: * ;
8+ use itertools:: Itertools ;
89
910fn format_available_fields ( fields : & [ GqlObjectField ] ) -> String {
10- fields
11- . iter ( )
12- . map ( |ref field| & field. name )
13- . fold ( String :: new ( ) , |mut acc, item| {
14- acc. push_str ( item) ;
15- acc. push_str ( ", " ) ;
16- acc
17- } )
18- . trim_end_matches ( ", " )
19- . to_owned ( )
11+ fields. iter ( ) . map ( |ref field| & field. name ) . format ( "`, `" ) . to_string ( )
2012}
2113
2214pub ( crate ) fn render_object_field (
@@ -94,7 +86,7 @@ pub(crate) fn field_impls_for_selection(
9486 format_err ! (
9587 "Could not find field `{}`. Available fields: `{}`." ,
9688 name,
97- format_available_fields( fields) . as_str ( )
89+ format_available_fields( fields)
9890 )
9991 } ) ?
10092 . type_
@@ -130,7 +122,7 @@ pub(crate) fn response_fields_for_selection(
130122 "Could not find field `{}` on `{}`. Available fields: `{}`." ,
131123 * name,
132124 type_name,
133- format_available_fields( schema_fields) . as_str ( )
125+ format_available_fields( schema_fields)
134126 )
135127 } ) ?;
136128 let ty = schema_field. type_ . to_rust (
You can’t perform that action at this time.
0 commit comments