diff --git a/rust/candid/src/types/type_env.rs b/rust/candid/src/types/type_env.rs index 23f5f8e3..fed6449b 100644 --- a/rust/candid/src/types/type_env.rs +++ b/rust/candid/src/types/type_env.rs @@ -142,7 +142,7 @@ impl TypeEnv { /// The implementation collects elements into a temporary vector and sorts the vector. pub fn to_sorted_iter(&self) -> impl Iterator { - let mut vec: Vec<_> = self.iter().collect(); + let mut vec: Vec<_> = self.0.iter().collect(); vec.sort_unstable_by_key(|elem| elem.0); vec.into_iter() } diff --git a/rust/candid_parser/src/bindings/rust.rs b/rust/candid_parser/src/bindings/rust.rs index ef23910d..651c722a 100644 --- a/rust/candid_parser/src/bindings/rust.rs +++ b/rust/candid_parser/src/bindings/rust.rs @@ -662,8 +662,7 @@ pub fn emit_bindgen(tree: &Config, env: &TypeEnv, actor: &Option) -> (Outp let def_list = if let Some(actor) = &actor { chase_actor(&env, actor).unwrap() } else { - env.0 - .to_sorted_iter() + env.to_sorted_iter() .map(|pair| pair.0.as_str()) .collect::>() }; @@ -1011,7 +1010,11 @@ impl NominalState<'_> { for (id, ty) in self.state.env.to_sorted_iter() { let elem = StateElem::Label(id.as_str()); let old = self.state.push_state(&elem); - let ty = self.nominalize(&mut res, &mut vec![TypePath::Id(id.as_str().to_string())], ty); + let ty = self.nominalize( + &mut res, + &mut vec![TypePath::Id(id.as_str().to_string())], + ty, + ); res.0.insert(id.clone(), ty); self.state.pop_state(old, elem); }