From ceff62c84b314dab164d858cd85a3f9eefae7c88 Mon Sep 17 00:00:00 2001 From: gavinleroy Date: Tue, 20 Aug 2024 17:46:43 -0400 Subject: [PATCH] Sort trait bounds by fn/trait/region --- ide/packages/print/src/private/argus.tsx | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/ide/packages/print/src/private/argus.tsx b/ide/packages/print/src/private/argus.tsx index b404b7f..d2935d4 100644 --- a/ide/packages/print/src/private/argus.tsx +++ b/ide/packages/print/src/private/argus.tsx @@ -125,12 +125,20 @@ export const PrintWhereClause = ({ }; const PrintClauseWithBounds = ({ o }: { o: ClauseWithBounds }) => { - const [traits, lifetimes] = _.partition(o.bounds, bound => "Trait" in bound); - const traitBounds = _.map(traits, bound => ); - const lifetimeBounds = _.map(lifetimes, bound => ( + // Sort the bounds to be Ty: Fn() + Trait + Region + const sortedBounds = _.sortBy(o.bounds, bound => + "FnTrait" in bound + ? 0 + : "Trait" in bound + ? 1 + : "Region" in bound + ? 2 + : undefined + ); + + const boundComponents = _.map(sortedBounds, bound => ( )); - const boundComponents = _.concat(traitBounds, lifetimeBounds); return ( <>