Skip to content

Commit

Permalink
Use BTreeMap for determinism
Browse files Browse the repository at this point in the history
  • Loading branch information
capickett committed Jul 9, 2024
1 parent e402885 commit da96813
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use syn::{
TypeParamBound, TypePath, WhereClause, WherePredicate,
};

use std::collections::HashMap;
use std::collections::BTreeMap;

pub(crate) fn derive(input: &DeriveInput) -> Result<TokenStream> {
let impls = match &input.data {
Expand Down Expand Up @@ -224,9 +224,9 @@ fn add_display_constraint_to_type_predicate(
fn extract_trait_constraints_from_source(
where_clause: &WhereClause,
type_params: &[&TypeParam],
) -> HashMap<Ident, Vec<TraitBound>> {
) -> BTreeMap<Ident, Vec<TraitBound>> {
// Add trait bounds provided at the declaration site of type parameters for the struct/enum.
let mut param_constraint_mapping: HashMap<Ident, Vec<TraitBound>> = type_params
let mut param_constraint_mapping: BTreeMap<Ident, Vec<TraitBound>> = type_params
.iter()
.map(|type_param| {
let trait_bounds: Vec<TraitBound> = type_param
Expand Down

0 comments on commit da96813

Please sign in to comment.