From 4005c74954678d89794d29626c938f2edc21fe20 Mon Sep 17 00:00:00 2001 From: Yan Chen <48968912+chenyan-dfinity@users.noreply.github.com> Date: Mon, 25 Mar 2024 09:16:27 -0700 Subject: [PATCH] fix --- rust/candid/src/pretty/candid.rs | 2 +- rust/candid/src/types/internal.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rust/candid/src/pretty/candid.rs b/rust/candid/src/pretty/candid.rs index 60aa1c89..c012da9d 100644 --- a/rust/candid/src/pretty/candid.rs +++ b/rust/candid/src/pretty/candid.rs @@ -120,7 +120,7 @@ pub fn pp_ty_inner(ty: &TypeInner) -> RcDoc { _ => unreachable!(), } } - Knot(ref id) => str(id.name), + Knot(ref id) => RcDoc::text(format!("{id}")), Unknown => str("unknown"), Future => str("future"), } diff --git a/rust/candid/src/types/internal.rs b/rust/candid/src/types/internal.rs index 2d61d3d0..f41f2179 100644 --- a/rust/candid/src/types/internal.rs +++ b/rust/candid/src/types/internal.rs @@ -329,7 +329,7 @@ pub fn text_size(t: &Type, limit: i32) -> Result { Float32 | Float64 => 7, Reserved => 8, Principal => 9, - Knot(id) => id.name.len() as i32, + Knot(_) => 10, Var(id) => id.len() as i32, Opt(t) => 4 + text_size(t, limit - 4)?, Vec(t) => 4 + text_size(t, limit - 4)?,