Skip to content

Commit

Permalink
remove extraneous iterator conversions
Browse files Browse the repository at this point in the history
  • Loading branch information
BlaineHeffron committed Jun 5, 2024
1 parent 8976b6c commit cacf64b
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions cmd/crates/soroban-spec-typescript/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,10 @@ pub fn generate(spec: &[ScSpecEntry]) -> String {
cases: vec![],
});
}
// Filter out function entries with names that start with "__"
let filtered_collected: Vec<_> = collected
// Filter out function entries with names that start with "__" and partition the results
let (fns, other): (Vec<_>, Vec<_>) = collected
.into_iter()
.filter(|entry| matches!(entry, Entry::Function { name, .. } if !name.starts_with("__")))
.collect();
let (fns, other): (Vec<_>, Vec<_>) = filtered_collected
.into_iter()
.partition(|entry| matches!(entry, Entry::Function { .. }));
let top = other.iter().map(entry_to_method_type).join("\n");
let bottom = generate_class(&fns, spec);
Expand Down

0 comments on commit cacf64b

Please sign in to comment.