File tree Expand file tree Collapse file tree 4 files changed +20
-21
lines changed
graphql_client_codegen/src/query Expand file tree Collapse file tree 4 files changed +20
-21
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ use prettytable::*;
5
5
use serde:: * ;
6
6
use structopt:: StructOpt ;
7
7
8
+ #[ allow( clippy:: upper_case_acronyms) ]
8
9
type URI = String ;
9
10
10
11
#[ derive( GraphQLQuery ) ]
@@ -79,16 +80,16 @@ fn main() -> Result<(), anyhow::Error> {
79
80
table. set_format ( * prettytable:: format:: consts:: FORMAT_NO_LINESEP_WITH_TITLE ) ;
80
81
table. set_titles ( row ! ( b => "issue" , "comments" ) ) ;
81
82
82
- for issue in & response_data
83
+ for issue in response_data
83
84
. repository
84
85
. expect ( "missing repository" )
85
86
. issues
86
87
. nodes
87
88
. expect ( "issue nodes is null" )
89
+ . iter ( )
90
+ . flatten ( )
88
91
{
89
- if let Some ( issue) = issue {
90
- table. add_row ( row ! ( issue. title, issue. comments. total_count) ) ;
91
- }
92
+ table. add_row ( row ! ( issue. title, issue. comments. total_count) ) ;
92
93
}
93
94
94
95
table. printstd ( ) ;
Original file line number Diff line number Diff line change @@ -98,22 +98,20 @@ fn render_response(response: graphql_client_web::Response<puppy_smiles::Response
98
98
. map ( |puppy| puppy. fullname_id . clone ( ) ) ;
99
99
LAST_ENTRY . lock ( ) . unwrap_throw ( ) . replace ( new_cursor) ;
100
100
101
- for puppy in & listings {
102
- if let Some ( puppy) = puppy {
103
- write ! (
104
- inner_html,
105
- r#"
101
+ for puppy in listings. iter ( ) . flatten ( ) {
102
+ write ! (
103
+ inner_html,
104
+ r#"
106
105
<div class="card" style="width: 26rem;">
107
106
<img class="img-thumbnail card-img-top" alt="{}" src="{}" />
108
107
<div class="card-body">
109
108
<h5 class="card-title">{}</h5>
110
109
</div>
111
110
</div>
112
111
"# ,
113
- puppy. title, puppy. url, puppy. title
114
- )
115
- . expect_throw ( "write to string" ) ;
116
- }
112
+ puppy. title, puppy. url, puppy. title
113
+ )
114
+ . expect_throw ( "write to string" ) ;
117
115
}
118
116
response. set_inner_html ( & format ! (
119
117
"<h2>response:</h2><div class=\" container\" ><div class=\" row\" >{}</div></div>" ,
Original file line number Diff line number Diff line change @@ -107,15 +107,15 @@ fn main() -> anyhow::Result<()> {
107
107
selected_operation,
108
108
custom_scalars_module,
109
109
} => generate:: generate_code ( generate:: CliCodegenParams {
110
+ query_path,
111
+ schema_path,
112
+ selected_operation,
110
113
variables_derives,
111
114
response_derives,
112
115
deprecation_strategy,
113
- module_visibility,
114
116
no_formatting,
117
+ module_visibility,
115
118
output_directory,
116
- query_path,
117
- schema_path,
118
- selected_operation,
119
119
custom_scalars_module,
120
120
} ) ,
121
121
}
Original file line number Diff line number Diff line change @@ -131,13 +131,13 @@ impl SelectionParent {
131
131
}
132
132
}
133
133
134
- pub ( crate ) fn to_path_segment ( & self , query : & BoundQuery < ' _ > ) -> String {
134
+ pub ( crate ) fn to_path_segment ( self , query : & BoundQuery < ' _ > ) -> String {
135
135
match self {
136
136
SelectionParent :: Field ( id) | SelectionParent :: InlineFragment ( id) => {
137
- query. query . get_selection ( * id) . to_path_segment ( query)
137
+ query. query . get_selection ( id) . to_path_segment ( query)
138
138
}
139
- SelectionParent :: Operation ( id) => query. query . get_operation ( * id) . to_path_segment ( ) ,
140
- SelectionParent :: Fragment ( id) => query. query . get_fragment ( * id) . to_path_segment ( ) ,
139
+ SelectionParent :: Operation ( id) => query. query . get_operation ( id) . to_path_segment ( ) ,
140
+ SelectionParent :: Fragment ( id) => query. query . get_fragment ( id) . to_path_segment ( ) ,
141
141
}
142
142
}
143
143
}
You can’t perform that action at this time.
0 commit comments