From 8685323b1556dadf0dac5fc7a3d19aa80124e25b Mon Sep 17 00:00:00 2001 From: Stephen Chung Date: Sat, 11 Feb 2023 23:55:07 +0800 Subject: [PATCH] Use SmartString for comments. --- src/ast/script_fn.rs | 2 +- src/func/hashing.rs | 2 +- src/module/mod.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ast/script_fn.rs b/src/ast/script_fn.rs index e42e1b8c..7126fdda 100644 --- a/src/ast/script_fn.rs +++ b/src/ast/script_fn.rs @@ -34,7 +34,7 @@ pub struct ScriptFnDef { /// /// Each line in non-block doc-comments starts with `///`. #[cfg(feature = "metadata")] - pub comments: Box<[crate::Identifier]>, + pub comments: Box<[crate::SmartString]>, } impl fmt::Display for ScriptFnDef { diff --git a/src/func/hashing.rs b/src/func/hashing.rs index b3e04613..ac0f1b27 100644 --- a/src/func/hashing.rs +++ b/src/func/hashing.rs @@ -27,7 +27,7 @@ impl Hasher for StraightHasher { fn finish(&self) -> u64 { self.0 } - #[inline(always)] + #[cold] fn write(&mut self, _bytes: &[u8]) { panic!("StraightHasher can only hash u64 values"); } diff --git a/src/module/mod.rs b/src/module/mod.rs index 962938ec..87b4f831 100644 --- a/src/module/mod.rs +++ b/src/module/mod.rs @@ -85,7 +85,7 @@ pub struct FuncInfoMetadata { pub return_type: Identifier, /// Comments. #[cfg(feature = "metadata")] - pub comments: Box<[Identifier]>, + pub comments: Box<[SmartString]>, } /// A type containing a single registered function.