Skip to content

Commit e7cb853

Browse files
committed
fmt
1 parent e6eb484 commit e7cb853

File tree

6 files changed

+33
-22
lines changed

6 files changed

+33
-22
lines changed

progenitor-client/src/progenitor_client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ impl<E> RequestBuilderExt<E> for RequestBuilder {
432432
self,
433433
iter: I,
434434
) -> Result<Self, Error<E>> {
435-
use reqwest::multipart::{Form};
435+
use reqwest::multipart::Form;
436436

437437
let mut form = Form::new();
438438
for (name, value) in iter {

progenitor-impl/src/cli.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -315,19 +315,19 @@ impl Generator {
315315
OperationParameterKind::Body(_) => unreachable!(),
316316
};
317317

318-
let OperationParameterType::Type(arg_type_id) = &param.typ else {
318+
let OperationParameterType::Type(arg_type_id) = &param.typ
319+
else {
319320
panic!()
320321
};
321322
let arg_type = self.type_space.get_type(arg_type_id).unwrap();
322323
let arg_details = arg_type.details();
323-
let arg_type_name = match &arg_details{
324+
let arg_type_name = match &arg_details {
324325
typify::TypeDetails::Option(opt_id) => {
325-
let inner_type = self.type_space.get_type(opt_id).unwrap();
326+
let inner_type =
327+
self.type_space.get_type(opt_id).unwrap();
326328
inner_type.ident()
327329
}
328-
_ => {
329-
arg_type.ident()
330-
}
330+
_ => arg_type.ident(),
331331
};
332332

333333
let help = param.description.as_ref().map(|description| {
@@ -410,21 +410,21 @@ impl Generator {
410410
let arg_name = param.name.to_kebab_case();
411411
let arg_fn_name = sanitize(&param.name, Case::Snake);
412412
let arg_fn = format_ident!("{}", arg_fn_name);
413-
let OperationParameterType::Type(arg_type_id) = &param.typ else {
413+
let OperationParameterType::Type(arg_type_id) = &param.typ
414+
else {
414415
panic!()
415416
};
416417
let arg_type = self.type_space.get_type(arg_type_id).unwrap();
417418

418419
// TODO this really should be simpler.
419420
let arg_details = arg_type.details();
420-
let arg_type_name = match &arg_details{
421+
let arg_type_name = match &arg_details {
421422
typify::TypeDetails::Option(opt_id) => {
422-
let inner_type = self.type_space.get_type(opt_id).unwrap();
423+
let inner_type =
424+
self.type_space.get_type(opt_id).unwrap();
423425
inner_type.ident()
424426
}
425-
_ => {
426-
arg_type.ident()
427-
}
427+
_ => arg_type.ident(),
428428
};
429429

430430
quote! {

progenitor-impl/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
use std::collections::{HashMap, HashSet};
44

5-
use openapiv3::OpenAPI;
65
use indexmap::IndexSet;
6+
use openapiv3::OpenAPI;
77
use proc_macro2::TokenStream;
88
use quote::quote;
99
use serde::Deserialize;

progenitor-impl/src/method.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1291,7 +1291,7 @@ impl Generator {
12911291
typify::TypeDetails::Array(item, _) => {
12921292
Some(DropshotPagination { item })
12931293
}
1294-
_ => None
1294+
_ => None,
12951295
}
12961296
}
12971297

progenitor-impl/src/template.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,10 @@ impl PathTemplate {
3737
if let Component::Parameter(n) = &component {
3838
let param = format_ident!(
3939
"{}",
40-
rename
41-
.get(&n)
42-
.unwrap_or_else(|| panic!("missing path name mapping {}", n)),
40+
rename.get(&n).unwrap_or_else(|| panic!(
41+
"missing path name mapping {}",
42+
n
43+
)),
4344
);
4445
Some(quote! {
4546
encode_path(&#param.to_string())

progenitor-macro/src/lib.rs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -269,11 +269,21 @@ fn do_generate_api(item: TokenStream) -> Result<TokenStream, syn::Error> {
269269

270270
// Force a rebuild when the given file is modified.
271271
const _: &str = include_str!(#path_str);
272+
272273
};
273274

274-
let output = expander::Expander::new(format!("{}", std::path::PathBuf::from(spec.value()).file_name().unwrap().to_string_lossy()))
275-
.fmt(expander::Edition::_2021)
276-
.verbose(true)
277-
.write_to_out_dir(output).expect("Writing file works. qed");
275+
println!("cargo::rerun-if-changed={}", path_str);
276+
277+
let output = expander::Expander::new(format!(
278+
"{}",
279+
std::path::PathBuf::from(spec.value())
280+
.file_name()
281+
.unwrap()
282+
.to_string_lossy()
283+
))
284+
.fmt(expander::Edition::_2021)
285+
.verbose(true)
286+
.write_to_out_dir(output)
287+
.expect("Writing file works. qed");
278288
Ok(output.into())
279289
}

0 commit comments

Comments
 (0)