From 3cba874524fcc3f27bfaf58f4a96dec521f809d6 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Mon, 6 Nov 2023 13:54:04 -0600 Subject: [PATCH] fix(edit): Format-by-clearing for keys/reprs, like decor In this we were inconsistent with decor which we rely on just clearing to get the default auto-formatted behavior. --- crates/toml_edit/src/key.rs | 2 +- crates/toml_edit/src/repr.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/toml_edit/src/key.rs b/crates/toml_edit/src/key.rs index c1ee1655..86d54dc2 100644 --- a/crates/toml_edit/src/key.rs +++ b/crates/toml_edit/src/key.rs @@ -123,7 +123,7 @@ impl Key { /// Auto formats the key. pub fn fmt(&mut self) { - self.repr = Some(to_key_repr(&self.key)); + self.repr = None; self.decor.clear(); } diff --git a/crates/toml_edit/src/repr.rs b/crates/toml_edit/src/repr.rs index d4ab6c23..c4535e5a 100644 --- a/crates/toml_edit/src/repr.rs +++ b/crates/toml_edit/src/repr.rs @@ -82,7 +82,7 @@ where /// Auto formats the value. pub fn fmt(&mut self) { - self.repr = Some(self.value.to_repr()); + self.repr = None; } }