Skip to content

Commit 236ff5f

Browse files
author
daniel.eades
committed
minor refactoring
1 parent 1380bf7 commit 236ff5f

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

graphql_client_codegen/src/generated_module.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@ struct OperationNotFound {
1515

1616
impl Display for OperationNotFound {
1717
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
18-
f.write_str("Could not find an operation named ")?;
19-
f.write_str(&self.operation_name)?;
20-
f.write_str(" in the query document.")
18+
write!(
19+
f,
20+
"Could not find an operation named {} in the query document.",
21+
&self.operation_name,
22+
)
2123
}
2224
}
2325

@@ -78,7 +80,7 @@ impl GeneratedModule<'_> {
7880
let query_string = &self.query_string;
7981
let impls = self.build_impls()?;
8082

81-
let struct_declaration: Option<_> = match self.options.mode {
83+
let struct_declaration = match self.options.mode {
8284
CodegenMode::Cli => Some(quote!(#module_visibility struct #operation_name_ident;)),
8385
// The struct is already present in derive mode.
8486
CodegenMode::Derive => None,

graphql_client_codegen/src/lib.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,7 @@ impl Display for ReadFileError {
182182
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\".")
183183
}
184184
Self::ReadError { path, .. } => {
185-
f.write_str("Error reading file at: ")?;
186-
f.write_str(path)
185+
write!(f, "Error reading file at: {path}")
187186
}
188187
}
189188
}

0 commit comments

Comments
 (0)