Skip to content

Commit 74af385

Browse files
committed
Clippy
1 parent de80139 commit 74af385

File tree

4 files changed

+20
-21
lines changed

4 files changed

+20
-21
lines changed

examples/github/examples/github.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use prettytable::*;
55
use serde::*;
66
use structopt::StructOpt;
77

8+
#[allow(clippy::upper_case_acronyms)]
89
type URI = String;
910

1011
#[derive(GraphQLQuery)]
@@ -79,16 +80,16 @@ fn main() -> Result<(), anyhow::Error> {
7980
table.set_format(*prettytable::format::consts::FORMAT_NO_LINESEP_WITH_TITLE);
8081
table.set_titles(row!(b => "issue", "comments"));
8182

82-
for issue in &response_data
83+
for issue in response_data
8384
.repository
8485
.expect("missing repository")
8586
.issues
8687
.nodes
8788
.expect("issue nodes is null")
89+
.iter()
90+
.flatten()
8891
{
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));
9293
}
9394

9495
table.printstd();

examples/web/examples/web.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -98,22 +98,20 @@ fn render_response(response: graphql_client_web::Response<puppy_smiles::Response
9898
.map(|puppy| puppy.fullname_id.clone());
9999
LAST_ENTRY.lock().unwrap_throw().replace(new_cursor);
100100

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#"
106105
<div class="card" style="width: 26rem;">
107106
<img class="img-thumbnail card-img-top" alt="{}" src="{}" />
108107
<div class="card-body">
109108
<h5 class="card-title">{}</h5>
110109
</div>
111110
</div>
112111
"#,
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");
117115
}
118116
response.set_inner_html(&format!(
119117
"<h2>response:</h2><div class=\"container\"><div class=\"row\">{}</div></div>",

graphql_client_cli/src/main.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,15 @@ fn main() -> anyhow::Result<()> {
107107
selected_operation,
108108
custom_scalars_module,
109109
} => generate::generate_code(generate::CliCodegenParams {
110+
query_path,
111+
schema_path,
112+
selected_operation,
110113
variables_derives,
111114
response_derives,
112115
deprecation_strategy,
113-
module_visibility,
114116
no_formatting,
117+
module_visibility,
115118
output_directory,
116-
query_path,
117-
schema_path,
118-
selected_operation,
119119
custom_scalars_module,
120120
}),
121121
}

graphql_client_codegen/src/query/selection.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,13 +131,13 @@ impl SelectionParent {
131131
}
132132
}
133133

134-
pub(crate) fn to_path_segment(&self, query: &BoundQuery<'_>) -> String {
134+
pub(crate) fn to_path_segment(self, query: &BoundQuery<'_>) -> String {
135135
match self {
136136
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)
138138
}
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(),
141141
}
142142
}
143143
}

0 commit comments

Comments
 (0)