Skip to content

Commit

Permalink
fix(edit): Format-by-clearing for keys/reprs, like decor
Browse files Browse the repository at this point in the history
In this we were inconsistent with decor which we rely on just clearing
to get the default auto-formatted behavior.
  • Loading branch information
epage committed Nov 6, 2023
1 parent 6c8885e commit 3cba874
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion crates/toml_edit/src/key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
2 changes: 1 addition & 1 deletion crates/toml_edit/src/repr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ where

/// Auto formats the value.
pub fn fmt(&mut self) {
self.repr = Some(self.value.to_repr());
self.repr = None;
}
}

Expand Down

0 comments on commit 3cba874

Please sign in to comment.