From aab5061b56870e455b5d566d6ab7062db9419fcc Mon Sep 17 00:00:00 2001 From: "Joshua M. Clulow" Date: Fri, 17 Sep 2021 21:16:28 -0700 Subject: [PATCH] type definitions should occur in a stable order (rustfmt) --- src/main.rs | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/main.rs b/src/main.rs index 69e87e1..7224862 100644 --- a/src/main.rs +++ b/src/main.rs @@ -974,17 +974,21 @@ fn gen(api: &OpenAPI, ts: &mut TypeSpace) -> Result { * a stable order within the file, so we first collect a list of type IDs * that we can sort by their visible name. */ - let mut ids = ts.id_to_entry.values().filter_map(|te| match &te.details { - TypeDetails::Object(_) - | TypeDetails::NewType(_) - | TypeDetails::Enumeration(_) => { - Some((te.name.as_deref().unwrap(), &te.id)) - } - TypeDetails::Basic - | TypeDetails::Unknown - | TypeDetails::Array(_) - | TypeDetails::Optional(_) => None, - }).collect::>(); + let mut ids = ts + .id_to_entry + .values() + .filter_map(|te| match &te.details { + TypeDetails::Object(_) + | TypeDetails::NewType(_) + | TypeDetails::Enumeration(_) => { + Some((te.name.as_deref().unwrap(), &te.id)) + } + TypeDetails::Basic + | TypeDetails::Unknown + | TypeDetails::Array(_) + | TypeDetails::Optional(_) => None, + }) + .collect::>(); ids.sort_by(|a, b| a.0.cmp(&b.0)); a("pub mod types {");