From 7f80093eaa9b04735c7be1e0b02617784c09d136 Mon Sep 17 00:00:00 2001 From: Filip Tibell Date: Mon, 22 Apr 2024 19:19:13 +0200 Subject: [PATCH] Add note about results in value format impl --- crates/lune-utils/src/fmt/value/mod.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/crates/lune-utils/src/fmt/value/mod.rs b/crates/lune-utils/src/fmt/value/mod.rs index 8fb2e24..40d47cb 100644 --- a/crates/lune-utils/src/fmt/value/mod.rs +++ b/crates/lune-utils/src/fmt/value/mod.rs @@ -13,9 +13,13 @@ pub use self::config::ValueFormatConfig; use self::basic::{format_value_styled, lua_value_as_plain_string_key}; use self::style::STYLE_DIM; -type FmtResult = Result; - -fn format_value_inner(value: &LuaValue, config: &ValueFormatConfig, depth: usize) -> FmtResult { +// NOTE: We return a result here but it's really just to make handling +// of the `write!` calls easier. Writing into a string should never fail. +fn format_value_inner( + value: &LuaValue, + config: &ValueFormatConfig, + depth: usize, +) -> Result { let mut buffer = String::new(); // TODO: Rewrite this section to not be recursive and